@@ -17,18 +17,10 @@ const child = spawn(process.execPath, [ '-i' ], {
1717
1818let stdout = '' ;
1919child . stdout . setEncoding ( 'utf8' ) ;
20- child . stdout . pipe ( process . stdout ) ;
2120child . stdout . on ( 'data' , function ( c ) {
2221 stdout += c ;
2322} ) ;
2423
25- child . stdin . write = ( ( original ) => {
26- return ( chunk ) => {
27- process . stderr . write ( chunk ) ;
28- return original . call ( child . stdin , chunk ) ;
29- } ;
30- } ) ( child . stdin . write ) ;
31-
3224child . stdout . once ( 'data' , common . mustCall ( ( ) => {
3325 process . on ( 'SIGUSR2' , common . mustCall ( ( ) => {
3426 process . kill ( child . pid , 'SIGINT' ) ;
@@ -45,6 +37,12 @@ child.stdout.once('data', common.mustCall(() => {
4537
4638child . on ( 'close' , function ( code ) {
4739 assert . strictEqual ( code , 0 ) ;
48- assert . notStrictEqual ( stdout . indexOf ( 'Script execution interrupted.\n' ) , - 1 ) ;
49- assert . notStrictEqual ( stdout . indexOf ( '42042\n' ) , - 1 ) ;
40+ assert . ok (
41+ stdout . includes ( 'Script execution interrupted.\n' ) ,
42+ `Expected stdout to contain "Script execution interrupted.", got ${ stdout } `
43+ ) ;
44+ assert . ok (
45+ stdout . includes ( '42042\n' ) ,
46+ `Expected stdout to contain "42042", got ${ stdout } `
47+ ) ;
5048} ) ;
0 commit comments