diff --git a/.eslintignore b/.eslintignore index c29ea07ce66841..46a631963a4aa7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ lib/punycode.js +test/addons/doc-*/ test/fixtures test/**/node_modules test/parallel/test-fs-non-number-arguments-throw.js diff --git a/src/node.js b/src/node.js index cb50341ce2ea8c..065c337e743993 100644 --- a/src/node.js +++ b/src/node.js @@ -558,8 +558,13 @@ 'return require("vm").runInThisContext(' + JSON.stringify(body) + ', { filename: ' + JSON.stringify(name) + ' });\n'; - var result = module._compile(script, name + '-wrapper'); - if (process._print_eval) console.log(result); + // Defer evaluation for a tick. This is a workaround for deferred + // events not firing when evaluating scripts from the command line, + // see https://github.com/nodejs/io.js/issues/1600. + process.nextTick(function() { + var result = module._compile(script, name + '-wrapper'); + if (process._print_eval) console.log(result); + }); } function createWritableStdioStream(fd) { diff --git a/test/addons/async-hello-world/binding.cc b/test/addons/async-hello-world/binding.cc index 99f79431a05a60..f458dc6a5632fd 100644 --- a/test/addons/async-hello-world/binding.cc +++ b/test/addons/async-hello-world/binding.cc @@ -39,7 +39,7 @@ void AfterAsync(uv_work_t* r) { delete req; if (try_catch.HasCaught()) { - FatalException(try_catch); + FatalException(isolate, try_catch); } } diff --git a/test/message/eval_messages.js b/test/message/eval_messages.js index 603acafe0936c4..0b17bf5f97ae52 100644 --- a/test/message/eval_messages.js +++ b/test/message/eval_messages.js @@ -1,5 +1,4 @@ 'use strict'; -// USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); var assert = require('assert'); diff --git a/test/message/eval_messages.out b/test/message/eval_messages.out index 809e788f7a4603..be2120ce795a95 100644 --- a/test/message/eval_messages.out +++ b/test/message/eval_messages.out @@ -6,9 +6,9 @@ SyntaxError: Strict mode code may not include a with statement at Object.exports.runInThisContext (vm.js:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at startup (node.js:*:*) at node.js:*:* + at doNTCallback0 (node.js:*:*) + at process._tickCallback (node.js:*:*) 42 42 [eval]:1 @@ -19,9 +19,9 @@ Error: hello at Object.exports.runInThisContext (vm.js:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at startup (node.js:*:*) at node.js:*:* + at doNTCallback0 (node.js:*:*) + at process._tickCallback (node.js:*:*) [eval]:1 throw new Error("hello") ^ @@ -30,9 +30,9 @@ Error: hello at Object.exports.runInThisContext (vm.js:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at startup (node.js:*:*) at node.js:*:* + at doNTCallback0 (node.js:*:*) + at process._tickCallback (node.js:*:*) 100 [eval]:1 var x = 100; y = x; @@ -42,9 +42,9 @@ ReferenceError: y is not defined at Object.exports.runInThisContext (vm.js:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at startup (node.js:*:*) at node.js:*:* + at doNTCallback0 (node.js:*:*) + at process._tickCallback (node.js:*:*) [eval]:1 var ______________________________________________; throw 10 ^ diff --git a/test/message/stdin_messages.js b/test/message/stdin_messages.js index eefa9e756dc312..e99c08553a916d 100644 --- a/test/message/stdin_messages.js +++ b/test/message/stdin_messages.js @@ -1,5 +1,4 @@ 'use strict'; -// USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); var assert = require('assert'); diff --git a/test/message/stdin_messages.out b/test/message/stdin_messages.out index 92d09a0a144428..9dc6451d1c3379 100644 --- a/test/message/stdin_messages.out +++ b/test/message/stdin_messages.out @@ -7,12 +7,8 @@ SyntaxError: Strict mode code may not include a with statement at Object.exports.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at Socket. (node.js:*:*) - at emitNone (events.js:*:*) - at Socket.emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - at doNTCallback2 (node.js:*:*) + at node.js:*:* + at doNTCallback0 (node.js:*:*) at process._tickCallback (node.js:*:*) 42 42 @@ -25,12 +21,9 @@ Error: hello at Object.exports.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at Socket. (node.js:*:*) - at emitNone (events.js:*:*) - at Socket.emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - at doNTCallback2 (node.js:*:*) + at node.js:*:* + at doNTCallback0 (node.js:*:*) + at process._tickCallback (node.js:*:*) [stdin]:1 throw new Error("hello") @@ -40,12 +33,9 @@ Error: hello at Object.exports.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at Socket. (node.js:*:*) - at emitNone (events.js:*:*) - at Socket.emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - at doNTCallback2 (node.js:*:*) + at node.js:*:* + at doNTCallback0 (node.js:*:*) + at process._tickCallback (node.js:*:*) 100 [stdin]:1 @@ -56,12 +46,9 @@ ReferenceError: y is not defined at Object.exports.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (node.js:*:*) - at Socket. (node.js:*:*) - at emitNone (events.js:*:*) - at Socket.emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - at doNTCallback2 (node.js:*:*) + at node.js:*:* + at doNTCallback0 (node.js:*:*) + at process._tickCallback (node.js:*:*) [stdin]:1 var ______________________________________________; throw 10 diff --git a/test/parallel/test-cli-eval-event.js b/test/parallel/test-cli-eval-event.js new file mode 100644 index 00000000000000..b19bdd38680f79 --- /dev/null +++ b/test/parallel/test-cli-eval-event.js @@ -0,0 +1,15 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const spawn = require('child_process').spawn; + +const child = spawn(process.execPath, ['-e', ` + const server = require('net').createServer().listen(0); + server.once('listening', server.close); +`]); + +child.once('exit', common.mustCall(function(exitCode, signalCode) { + assert.equal(exitCode, 0); + assert.equal(signalCode, null); +})); diff --git a/test/parallel/test-event-emitter-listeners-side-effects.js b/test/parallel/test-event-emitter-listeners-side-effects.js index de541c535ef0ed..23076128eddfc1 100644 --- a/test/parallel/test-event-emitter-listeners-side-effects.js +++ b/test/parallel/test-event-emitter-listeners-side-effects.js @@ -1,5 +1,4 @@ 'use strict'; -// USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-event-emitter-listeners.js b/test/parallel/test-event-emitter-listeners.js index be6b83856249b4..48a60609e7be88 100644 --- a/test/parallel/test-event-emitter-listeners.js +++ b/test/parallel/test-event-emitter-listeners.js @@ -1,5 +1,4 @@ 'use strict'; -// USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); var assert = require('assert');