-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: fix deferred events not working with -e
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: #1600 PR-URL: #1793 Reviewed-By: Trevor Norris <[email protected]>
- Loading branch information
1 parent
eb1856d
commit 93a44d5
Showing
4 changed files
with
41 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
})); |