@@ -12,7 +12,7 @@ const spawn = require('child_process').spawn;
1212
1313process . env . REPL_TEST_PPID = process . pid ;
1414const child = spawn ( process . execPath , [ '-i' ] , {
15- stdio : [ null , null , 2 ]
15+ stdio : [ null , null , 2 , 'ipc' ]
1616} ) ;
1717
1818let stdout = '' ;
@@ -22,17 +22,19 @@ child.stdout.on('data', function(c) {
2222} ) ;
2323
2424child . 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
3840child . on ( 'close' , function ( code ) {
0 commit comments