Skip to content

Commit

Permalink
test: fix flaky test-repl-sigint-nested-eval
Browse files Browse the repository at this point in the history
There is a race condition where process.kill can be sent before the
target is ready to receive the signal. Or at least that's what I think
is going on. Regardless, objectively, using setTimeout() to slightly
delay the invocation causes the test to not fail anymore using:
tools/test.py --repeat=1000 test/parallel/test-repl-sigint-nested-eval

Fixes: #41123
  • Loading branch information
Trott committed Nov 7, 2022
1 parent e1ac4e9 commit 06d77b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/parallel/test-repl-sigint-nested-eval.js
Expand Up @@ -23,7 +23,7 @@ child.stdout.on('data', function(c) {

child.stdout.once('data', common.mustCall(() => {
process.on('SIGUSR2', common.mustCall(() => {
process.kill(child.pid, 'SIGINT');
setTimeout(() => { process.kill(child.pid, 'SIGINT'); }, 10);
child.stdout.once('data', common.mustCall(() => {
// Make sure REPL still works.
child.stdin.end('"foobar"\n');
Expand Down

0 comments on commit 06d77b8

Please sign in to comment.