@@ -91,11 +91,11 @@ const spawn = require('child_process').spawn;
9191const bat = spawn (' cmd.exe' , [' /c' , ' my.bat' ]);
9292
9393bat .stdout .on (' data' , (data ) => {
94- console .log (data);
94+ console .log (data . toString () );
9595});
9696
9797bat .stderr .on (' data' , (data ) => {
98- console .log (data);
98+ console .log (data . toString () );
9999});
100100
101101bat .on (' exit' , (code ) => {
@@ -113,7 +113,7 @@ exec('my.bat', (err, stdout, stderr) => {
113113});
114114
115115// Script with spaces in the filename:
116- const bat = spawn (' "my script.cmd"' , [' a' , ' b' ], { shell: true });
116+ const bat = spawn (' "my script.cmd"' , [' a' , ' b' ], { shell: true });
117117// or:
118118exec (' "my script.cmd" a b' , (err , stdout , stderr ) => {
119119 // ...
@@ -383,7 +383,7 @@ ps.on('close', (code) => {
383383});
384384
385385grep .stdout .on (' data' , (data ) => {
386- console .log (` ${ data} ` );
386+ console .log (data . toString () );
387387});
388388
389389grep .stderr .on (' data' , (data ) => {
@@ -467,8 +467,8 @@ const out = fs.openSync('./out.log', 'a');
467467const err = fs .openSync (' ./out.log' , ' a' );
468468
469469const child = spawn (' prg' , [], {
470- detached: true ,
471- stdio: [ ' ignore' , out, err ]
470+ detached: true ,
471+ stdio: [ ' ignore' , out, err ]
472472});
473473
474474child .unref ();
@@ -850,7 +850,7 @@ as in this example:
850850' use strict' ;
851851const spawn = require (' child_process' ).spawn ;
852852
853- let child = spawn (' sh' , [' -c' ,
853+ const child = spawn (' sh' , [' -c' ,
854854 ` node -e "setInterval(() => {
855855 console.log(process.pid, 'is alive')
856856 }, 500);"`
@@ -1097,21 +1097,21 @@ const fs = require('fs');
10971097const child_process = require (' child_process' );
10981098
10991099const child = child_process .spawn (' ls' , {
1100- stdio: [
1101- 0 , // Use parents stdin for child
1102- ' pipe' , // Pipe child's stdout to parent
1103- fs .openSync (' err.out' , ' w' ) // Direct child's stderr to a file
1104- ]
1100+ stdio: [
1101+ 0 , // Use parent's stdin for child
1102+ ' pipe' , // Pipe child's stdout to parent
1103+ fs .openSync (' err.out' , ' w' ) // Direct child's stderr to a file
1104+ ]
11051105});
11061106
1107- assert .equal (child .stdio [0 ], null );
1108- assert .equal (child .stdio [0 ], child .stdin );
1107+ assert .strictEqual (child .stdio [0 ], null );
1108+ assert .strictEqual (child .stdio [0 ], child .stdin );
11091109
11101110assert (child .stdout );
1111- assert .equal (child .stdio [1 ], child .stdout );
1111+ assert .strictEqual (child .stdio [1 ], child .stdout );
11121112
1113- assert .equal (child .stdio [2 ], null );
1114- assert .equal (child .stdio [2 ], child .stderr );
1113+ assert .strictEqual (child .stdio [2 ], null );
1114+ assert .strictEqual (child .stdio [2 ], child .stderr );
11151115```
11161116
11171117### child.stdout
0 commit comments