diff --git a/test/parallel/test-repl-sigint-nested-eval.js b/test/parallel/test-repl-sigint-nested-eval.js index acf21a0abbc524..5830e08629b999 100644 --- a/test/parallel/test-repl-sigint-nested-eval.js +++ b/test/parallel/test-repl-sigint-nested-eval.js @@ -12,7 +12,7 @@ const spawn = require('child_process').spawn; process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { - stdio: [null, null, 2] + stdio: [null, null, 2, 'ipc'] }); let stdout = ''; @@ -22,17 +22,19 @@ child.stdout.on('data', function(c) { }); child.stdout.once('data', common.mustCall(() => { - process.on('SIGUSR2', common.mustCall(() => { - setTimeout(() => { process.kill(child.pid, 'SIGINT'); }, 10); + child.on('message', common.mustCall((msg) => { + assert.strictEqual(msg, 'repl is busy'); + process.kill(child.pid, 'SIGINT'); child.stdout.once('data', common.mustCall(() => { // Make sure REPL still works. child.stdin.end('"foobar"\n'); })); })); - child.stdin.write('process.kill(+process.env.REPL_TEST_PPID, "SIGUSR2");' + - 'vm.runInThisContext("while(true){}", ' + - '{ breakOnSigint: true });\n'); + child.stdin.write( + 'vm.runInThisContext("process.send(\'repl is busy\'); while(true){}", ' + + '{ breakOnSigint: true });\n' + ); })); child.on('close', function(code) {