Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: fix flaky test-vm-sigint-existing-handler
Set the `SIGUSR2` handler before spawning the child process to make sure
the signal is always handled.

Ref: #7854
Fixes: #7981
  • Loading branch information
addaleax committed Aug 4, 2016
commit f0bf2c2a6ba4b115b1c7805f57d518fc515f10a7
7 changes: 4 additions & 3 deletions test/parallel/test-vm-sigint-existing-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,17 @@ if (process.argv[2] === 'child') {
}

process.env.REPL_TEST_PPID = process.pid;
const child = spawn(process.execPath, [ __filename, 'child' ], {
stdio: [null, 'inherit', 'inherit']
});

process.on('SIGUSR2', common.mustCall(() => {
// First kill() breaks the while(true) loop, second one invokes the real
// signal handlers.
process.kill(child.pid, 'SIGINT');
}, 3));

const child = spawn(process.execPath, [ __filename, 'child' ], {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before landing, would you mind removing the spaces inside of the braces?

stdio: [null, 'inherit', 'inherit']
});

child.on('close', function(code, signal) {
assert.strictEqual(signal, null);
assert.strictEqual(code, 0);
Expand Down