From 5f995ddf0ddf004e3541dc29a8c5004d10e82444 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Sat, 23 Jul 2016 20:40:11 +0200 Subject: [PATCH] test: fix test-vm-sigint flakiness Set the `SIGUSR2` handler before spawning the child process to make sure the signal is always handled. --- test/parallel/test-vm-sigint.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js index 11497733ce7eb1..e7b19445bcb1a4 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);