diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-15 23:49:27 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-15 23:57:28 +0200 |
commit | fffe30f57456015e983f901dffa1364059e4bc49 (patch) | |
tree | 3ae2abd15c8433d4a2815464a317760e69a3ac76 | |
parent | fc97a98e22712ebc9ba2d0c7b44c8ec8321fb5bd (diff) |
Never throw uncaught exceptions out from compiler.js, but just report the exception message to stderr. Fixes other.test_warn_undefined on Windows, which would fail if Python spawned node.js in the case where it printed stderr and terminated to an uncaught exception, leaving unflushed data to stderr, and not all unresolved symbol errors were printed to console. Node.js stderr does not have a flush() mechanism, so must gracefully terminate the execution instead.
-rw-r--r-- | src/compiler.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler.js b/src/compiler.js index e9197a5d..aa3c7b92 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -311,12 +311,16 @@ function compile(raw) { B = new Benchmarker(); -if (ll_file) { - if (ll_file.indexOf(String.fromCharCode(10)) == -1) { - compile(read(ll_file)); - } else { - compile(ll_file); // we are given raw .ll +try { + if (ll_file) { + if (ll_file.indexOf(String.fromCharCode(10)) == -1) { + compile(read(ll_file)); + } else { + compile(ll_file); // we are given raw .ll + } } +} catch(err) { + printErr('aborting from js compiler due to exception: ' + err); } //var M = keys(tokenCacheMisses).map(function(m) { return [m, misses[m]] }).sort(function(a, b) { return a[1] - b[1] }); |