summaryrefslogtreecommitdiff
path: root/test/parallel/test-vm-sigint.js
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2016-07-23 20:40:11 +0200
committerAnna Henningsen <anna@addaleax.net>2016-08-02 15:40:04 +0200
commit93ac2ea36e4a77211b6ba68240833c902c6e057a (patch)
tree7f75f31b1be5270d8f09426c82bd84a53e91d031 /test/parallel/test-vm-sigint.js
parent1b24b37299a15722c11deeb4b663ba39cdc38d09 (diff)
downloadandroid-node-v8-93ac2ea36e4a77211b6ba68240833c902c6e057a.tar.gz
android-node-v8-93ac2ea36e4a77211b6ba68240833c902c6e057a.tar.bz2
android-node-v8-93ac2ea36e4a77211b6ba68240833c902c6e057a.zip
test: fix test-vm-sigint flakiness
Set the `SIGUSR2` handler before spawning the child process to make sure the signal is always handled. Fixes: https://github.com/nodejs/node/issues/7767 PR-URL: https://github.com/nodejs/node/pull/7854 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-vm-sigint.js')
-rw-r--r--test/parallel/test-vm-sigint.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js
index 2488b0d1c0..15d61d3232 100644
--- a/test/parallel/test-vm-sigint.js
+++ b/test/parallel/test-vm-sigint.js
@@ -25,14 +25,14 @@ if (process.argv[2] === 'child') {
}
process.env.REPL_TEST_PPID = process.pid;
-const child = spawn(process.execPath, [ __filename, 'child' ], {
- stdio: [null, 'pipe', 'inherit']
-});
-
process.on('SIGUSR2', common.mustCall(() => {
process.kill(child.pid, 'SIGINT');
}));
+const child = spawn(process.execPath, [ __filename, 'child' ], {
+ stdio: [null, 'pipe', 'inherit']
+});
+
child.on('close', common.mustCall((code, signal) => {
assert.strictEqual(signal, null);
assert.strictEqual(code, 0);