Skip to content

Commit 1c771ae

Browse files
committed
fixup! test: fix flaky test-repl-sigint-nested-eval
1 parent 3f3bb43 commit 1c771ae

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/parallel/test-repl-sigint-nested-eval.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const spawn = require('child_process').spawn;
1212

1313
process.env.REPL_TEST_PPID = process.pid;
1414
const child = spawn(process.execPath, [ '-i' ], {
15-
stdio: [null, null, 2]
15+
stdio: [null, null, 2, 'ipc']
1616
});
1717

1818
let stdout = '';
@@ -22,17 +22,19 @@ child.stdout.on('data', function(c) {
2222
});
2323

2424
child.stdout.once('data', common.mustCall(() => {
25-
process.on('SIGUSR2', common.mustCall(() => {
26-
setTimeout(() => { process.kill(child.pid, 'SIGINT'); }, 10);
25+
child.on('message', common.mustCall((msg) => {
26+
assert.strictEqual(msg, 'repl is busy');
27+
process.kill(child.pid, 'SIGINT');
2728
child.stdout.once('data', common.mustCall(() => {
2829
// Make sure REPL still works.
2930
child.stdin.end('"foobar"\n');
3031
}));
3132
}));
3233

33-
child.stdin.write('process.kill(+process.env.REPL_TEST_PPID, "SIGUSR2");' +
34-
'vm.runInThisContext("while(true){}", ' +
35-
'{ breakOnSigint: true });\n');
34+
child.stdin.write(
35+
'vm.runInThisContext("process.send(\'repl is busy\'); while(true){}", ' +
36+
'{ breakOnSigint: true });\n'
37+
);
3638
}));
3739

3840
child.on('close', function(code) {

0 commit comments

Comments
 (0)