File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 11import { EOL } from 'node:os' ;
22
3- const args = process . argv . slice ( 2 ) ;
3+ import { argv , stdout , stdin , exit } from 'node:process' ;
4+
5+ const args = argv . slice ( 2 ) ;
46
57console . log ( `Total number of arguments is ${ args . length } ` ) ;
68console . log ( `Arguments: ${ JSON . stringify ( args ) } ${ EOL } ` ) ;
79
810const echoInput = ( chunk ) => {
911 const chunkStringified = chunk . toString ( ) ;
10- if ( chunkStringified . includes ( 'CLOSE' ) ) process . exit ( 0 ) ;
11- process . stdout . write ( `Received from master process: ${ chunk . toString ( ) } ${ EOL } ` )
12+
13+ if ( chunkStringified . includes ( 'CLOSE' ) ) {
14+ exit ( 0 ) ;
15+ }
16+
17+ stdout . write ( `Received from master process: ${ chunk . toString ( ) } ${ EOL } ` )
1218} ;
1319
14- process . stdin . on ( 'data' , echoInput ) ;
20+ stdin . on ( 'data' , echoInput ) ;
You can’t perform that action at this time.
0 commit comments