Skip to content

Commit f00f197

Browse files
authored
Don't print backtrace when file_packager fails (#11784)
Use check_call rather than run_process to print a nice failure message and exit cleanly. Also error out if the input files are missing rather than just warning. Seems like passing non-existent files should be fatal.
1 parent c5cc009 commit f00f197

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

emcc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2585,7 +2585,7 @@ def get_final():
25852585
file_args.append('--lz4')
25862586
if options.use_preload_plugins:
25872587
file_args.append('--use-preload-plugins')
2588-
file_code = run_process([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE).stdout
2588+
file_code = shared.check_call([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE).stdout
25892589
options.pre_js = js_manipulation.add_files_pre_js(options.pre_js, file_code)
25902590

25912591
# Apply pre and postjs files

tools/file_packager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,13 @@ def main():
254254
data_files.append({'srcpath': srcpath, 'dstpath': dstpath, 'mode': mode,
255255
'explicit_dst_path': uses_at_notation})
256256
else:
257-
print('Warning: ' + arg + ' does not exist, ignoring.', file=sys.stderr)
257+
print('error: ' + arg + ' does not exist', file=sys.stderr)
258+
return 1
258259
elif leading == 'exclude':
259260
excluded_patterns.append(arg)
260261
else:
261262
print('Unknown parameter:', arg, file=sys.stderr)
262-
sys.exit(1)
263+
return 1
263264

264265
if (not force) and not data_files:
265266
has_preloaded = False

0 commit comments

Comments
 (0)