66 ArrayPrototypeMap,
77 ArrayPrototypePushApply,
88 ArrayPrototypeSlice,
9+ StringPrototypeStartsWith,
910} = primordials ;
1011
1112const {
@@ -38,7 +39,9 @@ const kPreserveOutput = getOptionValue('--watch-preserve-output');
3839const kCommand = ArrayPrototypeSlice ( process . argv , 1 ) ;
3940const kCommandStr = inspect ( ArrayPrototypeJoin ( kCommand , ' ' ) ) ;
4041const args = ArrayPrototypeFilter ( process . execArgv , ( arg , i , arr ) =>
41- arg !== '--watch-path' && arr [ i - 1 ] !== '--watch-path' && arg !== '--watch' && arg !== '--watch-preserve-output' ) ;
42+ ! StringPrototypeStartsWith ( arg , '--watch-path' ) &&
43+ ( ! arr [ i - 1 ] || ! StringPrototypeStartsWith ( arr [ i - 1 ] , '--watch-path' ) ) &&
44+ arg !== '--watch' && arg !== '--watch-preserve-output' ) ;
4245ArrayPrototypePushApply ( args , kCommand ) ;
4346
4447const watcher = new FilesWatcher ( { throttle : 500 , mode : kShouldFilterModules ? 'filter' : 'all' } ) ;
@@ -50,7 +53,7 @@ let exited;
5053
5154function start ( ) {
5255 exited = false ;
53- const stdio = kShouldFilterModules ? [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] : undefined ;
56+ const stdio = kShouldFilterModules ? [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] : 'inherit' ;
5457 child = spawn ( process . execPath , args , { stdio, env : { ...process . env , WATCH_REPORT_DEPENDENCIES : '1' } } ) ;
5558 watcher . watchChildProcessModules ( child ) ;
5659 child . once ( 'exit' , ( code ) => {
0 commit comments