Browse Source

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>
v6.x
Santiago Gimeno 9 years ago
committed by cjihrig
parent
commit
d94063a22b
  1. 8
      test/parallel/test-vm-sigint.js

8
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);

Loading…
Cancel
Save