Skip to content

Commit

Permalink
test: fix test-vm-sigint flakiness
Browse files Browse the repository at this point in the history
Set the `SIGUSR2` handler before spawning the child process to make sure
the signal is always handled.

Fixes: #7767
PR-URL: #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>
  • Loading branch information
santigimeno authored and cjihrig committed Aug 10, 2016
1 parent 0a07201 commit d94063a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/parallel/test-vm-sigint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d94063a

Please sign in to comment.