summaryrefslogtreecommitdiff
path: root/test/parallel/test-vm-sigint.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2016-08-04 23:48:03 +0200
committerAnna Henningsen <anna@addaleax.net>2016-08-08 14:48:01 +0200
commitbe73480eec900604697c43c7664627a286be8ce4 (patch)
tree7a25a5a7a40ccf7b2fa86218bf379d7695b1333c /test/parallel/test-vm-sigint.js
parentb635f7b0e7bf56846750914d15d4869b4530c004 (diff)
downloadandroid-node-v8-be73480eec900604697c43c7664627a286be8ce4.tar.gz
android-node-v8-be73480eec900604697c43c7664627a286be8ce4.tar.bz2
android-node-v8-be73480eec900604697c43c7664627a286be8ce4.zip
test: fix flaky test-vm-sigint-existing-handler
Set the `SIGUSR2` handler before spawning the child process to make sure the signal is always handled. Ref: https://github.com/nodejs/node/pull/7854 Fixes: https://github.com/nodejs/node/issues/7981 PR-URL: https://github.com/nodejs/node/pull/7982 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-vm-sigint.js')
-rw-r--r--test/parallel/test-vm-sigint.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js
index 15d61d3232..8846338b78 100644
--- a/test/parallel/test-vm-sigint.js
+++ b/test/parallel/test-vm-sigint.js
@@ -25,11 +25,14 @@ if (process.argv[2] === 'child') {
}
process.env.REPL_TEST_PPID = process.pid;
+
+// Set the `SIGUSR2` handler before spawning the child process to make sure
+// the signal is always handled.
process.on('SIGUSR2', common.mustCall(() => {
process.kill(child.pid, 'SIGINT');
}));
-const child = spawn(process.execPath, [ __filename, 'child' ], {
+const child = spawn(process.execPath, [__filename, 'child'], {
stdio: [null, 'pipe', 'inherit']
});