diff options
Diffstat (limited to 'test/parallel/test-vm-sigint-existing-handler.js')
-rw-r--r-- | test/parallel/test-vm-sigint-existing-handler.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/parallel/test-vm-sigint-existing-handler.js b/test/parallel/test-vm-sigint-existing-handler.js index 0f86b53dd2..c0ab1f8d92 100644 --- a/test/parallel/test-vm-sigint-existing-handler.js +++ b/test/parallel/test-vm-sigint-existing-handler.js @@ -61,16 +61,19 @@ if (process.argv[2] === 'child') { } process.env.REPL_TEST_PPID = process.pid; -const child = spawn(process.execPath, [ __filename, 'child' ], { - stdio: [null, 'inherit', 'inherit'] -}); +// Set the `SIGUSR2` handler before spawning the child process to make sure +// the signal is always handled. process.on('SIGUSR2', common.mustCall(() => { // First kill() breaks the while(true) loop, second one invokes the real // signal handlers. process.kill(child.pid, 'SIGINT'); }, 3)); +const child = spawn(process.execPath, [__filename, 'child'], { + stdio: [null, 'inherit', 'inherit'] +}); + child.on('close', function(code, signal) { assert.strictEqual(signal, null); assert.strictEqual(code, 0); |