diff options
author | Jez Ng <me@jezng.com> | 2013-07-09 00:50:09 -0700 |
---|---|---|
committer | Jez Ng <me@jezng.com> | 2013-07-10 13:40:23 -0700 |
commit | 0939e80a79bc7a68e82b9b116eee5aea860f7259 (patch) | |
tree | ce200831088c2b94cc376cc6368a00f9311f4183 /tools/js_optimizer.py | |
parent | 5d3ff92c55b8830c5f1c670a252107d3e8cded60 (diff) |
Don't throw KeyboardInterrupt from a child process.
This should fix #1327.
Diffstat (limited to 'tools/js_optimizer.py')
-rw-r--r-- | tools/js_optimizer.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py index a4e1ca6c..4e7d5474 100644 --- a/tools/js_optimizer.py +++ b/tools/js_optimizer.py @@ -102,16 +102,20 @@ start_asm_marker = '// EMSCRIPTEN_START_ASM\n' end_asm_marker = '// EMSCRIPTEN_END_ASM\n' def run_on_chunk(command): - filename = command[2] # XXX hackish - #print >> sys.stderr, 'running js optimizer command', ' '.join(command), '""""', open(filename).read() - output = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0] - assert len(output) > 0 and not output.startswith('Assertion failed'), 'Error in js optimizer: ' + output - filename = temp_files.get(os.path.basename(filename) + '.jo.js').name - f = open(filename, 'w') - f.write(output) - f.close() - if DEBUG and not shared.WINDOWS: print >> sys.stderr, '.' # Skip debug progress indicator on Windows, since it doesn't buffer well with multiple threads printing to console. - return filename + try: + filename = command[2] # XXX hackish + #print >> sys.stderr, 'running js optimizer command', ' '.join(command), '""""', open(filename).read() + output = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0] + assert len(output) > 0 and not output.startswith('Assertion failed'), 'Error in js optimizer: ' + output + filename = temp_files.get(os.path.basename(filename) + '.jo.js').name + f = open(filename, 'w') + f.write(output) + f.close() + if DEBUG and not shared.WINDOWS: print >> sys.stderr, '.' # Skip debug progress indicator on Windows, since it doesn't buffer well with multiple threads printing to console. + return filename + except KeyboardInterrupt: + # avoid throwing keyboard interrupts from a child process + raise Exception() def run_on_js(filename, passes, js_engine, jcache, source_map=False, extra_info=None): if isinstance(jcache, bool) and jcache: jcache = shared.JCache |