summaryrefslogtreecommitdiff
path: root/test/parallel/test-cli-eval-event.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-05-25 16:37:49 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2015-05-26 17:16:48 +0200
commit93a44d5228b2e1a885f6279f06c4175c174246be (patch)
treed2acd192f32bba94d354686742e8d2052cfeef66 /test/parallel/test-cli-eval-event.js
parenteb1856dfd14a2767993a72698b253051cc0b7d3b (diff)
downloadandroid-node-v8-93a44d5228b2e1a885f6279f06c4175c174246be.tar.gz
android-node-v8-93a44d5228b2e1a885f6279f06c4175c174246be.tar.bz2
android-node-v8-93a44d5228b2e1a885f6279f06c4175c174246be.zip
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: 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>
Diffstat (limited to 'test/parallel/test-cli-eval-event.js')
-rw-r--r--test/parallel/test-cli-eval-event.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-cli-eval-event.js b/test/parallel/test-cli-eval-event.js
new file mode 100644
index 0000000000..b19bdd3868
--- /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);
+}));