Skip to content

Commit 93ac2ea

Browse files
santigimenoaddaleax
authored andcommitted
test: fix test-vm-sigint flakiness
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 <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 1b24b37 commit 93ac2ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/parallel/test-vm-sigint.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ if (process.argv[2] === 'child') {
2525
}
2626

2727
process.env.REPL_TEST_PPID = process.pid;
28-
const child = spawn(process.execPath, [ __filename, 'child' ], {
29-
stdio: [null, 'pipe', 'inherit']
30-
});
31-
3228
process.on('SIGUSR2', common.mustCall(() => {
3329
process.kill(child.pid, 'SIGINT');
3430
}));
3531

32+
const child = spawn(process.execPath, [ __filename, 'child' ], {
33+
stdio: [null, 'pipe', 'inherit']
34+
});
35+
3636
child.on('close', common.mustCall((code, signal) => {
3737
assert.strictEqual(signal, null);
3838
assert.strictEqual(code, 0);

0 commit comments

Comments
 (0)