aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorJez Ng <me@jezng.com>2013-07-09 00:50:09 -0700
committerJez Ng <me@jezng.com>2013-07-10 13:40:23 -0700
commit0939e80a79bc7a68e82b9b116eee5aea860f7259 (patch)
treece200831088c2b94cc376cc6368a00f9311f4183 /emscripten.py
parent5d3ff92c55b8830c5f1c670a252107d3e8cded60 (diff)
Don't throw KeyboardInterrupt from a child process.
This should fix #1327.
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/emscripten.py b/emscripten.py
index df0587f9..be54b035 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