mirror of https://github.com/lukechilds/node.git
Browse Source
Defer evaluation of the script for a tick. This is a workaround for events not firing when evaluating scripts on the command line with -e. Fixes: https://github.com/nodejs/io.js/issues/1600 PR-URL: https://github.com/nodejs/io.js/pull/1793 Reviewed-By: Trevor Norris <trev.norris@gmail.com>v2.3.1-release
Ben Noordhuis
10 years ago
4 changed files with 41 additions and 34 deletions
@ -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); |
|||
})); |
Loading…
Reference in new issue