diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-15 10:26:28 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-15 10:26:28 -0700 |
commit | 85d286d05631104de01826dcab2465b29ca3c358 (patch) | |
tree | b24e90428b83aed8713e70517afd68fbb057a459 /emscripten.py | |
parent | b52b41fa588236ead80a2bffbfb88d5d8c8d225e (diff) | |
parent | 0939e80a79bc7a68e82b9b116eee5aea860f7259 (diff) |
Merge pull request #1357 from int3/keyboard-interrupt
Handle keyboard interrupt in child processes.
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/emscripten.py b/emscripten.py index d9367566..9a2abb9a 100755 --- a/emscripten.py +++ b/emscripten.py @@ -44,20 +44,25 @@ MIN_CHUNK_SIZE = 1024*1024 MAX_CHUNK_SIZE = float(os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or 'inf') # configuring this is just for debugging purposes def process_funcs((i, funcs, meta, settings_file, compiler, forwarded_file, libraries, compiler_engine, temp_files, DEBUG)): - funcs_file = temp_files.get('.func_%d.ll' % i).name - f = open(funcs_file, 'w') - f.write(funcs) - funcs = None - f.write('\n') - f.write(meta) - f.close() - out = jsrun.run_js( - compiler, - engine=compiler_engine, - args=[settings_file, funcs_file, 'funcs', forwarded_file] + libraries, - stdout=subprocess.PIPE, - cwd=path_from_root('src')) - tempfiles.try_delete(funcs_file) + try: + funcs_file = temp_files.get('.func_%d.ll' % i).name + f = open(funcs_file, 'w') + f.write(funcs) + funcs = None + f.write('\n') + f.write(meta) + f.close() + out = jsrun.run_js( + compiler, + engine=compiler_engine, + args=[settings_file, funcs_file, 'funcs', forwarded_file] + libraries, + stdout=subprocess.PIPE, + cwd=path_from_root('src')) + except KeyboardInterrupt: + # Python 2.7 seems to lock up when a child process throws KeyboardInterrupt + raise Exception() + finally: + tempfiles.try_delete(funcs_file) if DEBUG: print >> sys.stderr, '.' return out |