From 93ac2ea36e4a77211b6ba68240833c902c6e057a 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. Fixes: https://github.com/nodejs/node/issues/7767 PR-URL: https://github.com/nodejs/node/pull/7854 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- 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 2488b0d1c028f6..15d61d3232871a 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);