mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Fix: uncaughtException was broken for main module
See: http://github.com/ry/node/commit/635986e4338cf34cf8e1abc4343ffd69d109bb4e
This commit is contained in:
1 parent
17f3ffa633
commit
ef54777fa5
3 files changed
+20
-5
No files matched your search
+5
-1
@@ -749,7 +749,11 @@ if (process.argv[1]) {
|
||||
process.argv[1] = path.join(cwd, process.argv[1]);
|
||||
}
|
||||
|
||||
module.runMain();
|
||||
// REMOVEME: nextTick should not be necessary. This hack to get
|
||||
// test/simple/test-exception-handler2.js working.
|
||||
process.nextTick(function() {
|
||||
module.runMain();
|
||||
});
|
||||
} else {
|
||||
// No arguments, run the repl
|
||||
var repl = module.requireNative('repl');
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
before
|
||||
|
||||
|
||||
*.js:*
|
||||
*cript.runIn*Context(*);
|
||||
*^
|
||||
node.js:*
|
||||
throw e;
|
||||
^
|
||||
ReferenceError: foo is not defined
|
||||
at evalmachine.<anonymous>:*
|
||||
at *test/message/undefined_reference_in_new_context.js:*
|
||||
@@ -11,4 +10,6 @@ ReferenceError: foo is not defined
|
||||
at Module._loadScriptSync (node.js:*)
|
||||
at Module.loadSync (node.js:*)
|
||||
at Object.runMain (node.js:*)
|
||||
at Array.<anonymous> (node.js:*)
|
||||
at EventEmitter._tickCallback (node.js:*)
|
||||
at node.js:*
|
||||
@@ -1,11 +1,21 @@
|
||||
common = require("../common");
|
||||
assert = common.assert
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.log('Caught exception: ' + err);
|
||||
});
|
||||
|
||||
var timeoutFired = false;
|
||||
setTimeout(function () {
|
||||
console.log('This will still run.');
|
||||
timeoutFired = true;
|
||||
}, 500);
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.ok(timeoutFired);
|
||||
});
|
||||
|
||||
// Intentionally cause an exception, but don't catch it.
|
||||
nonexistentFunc();
|
||||
console.log('This will not run.');
|
||||
|
||||
Reference in new issue
Block a user