6
6
ArrayPrototypeMap,
7
7
ArrayPrototypePushApply,
8
8
ArrayPrototypeSlice,
9
+ StringPrototypeStartsWith,
9
10
} = primordials ;
10
11
11
12
const {
@@ -38,7 +39,9 @@ const kPreserveOutput = getOptionValue('--watch-preserve-output');
38
39
const kCommand = ArrayPrototypeSlice ( process . argv , 1 ) ;
39
40
const kCommandStr = inspect ( ArrayPrototypeJoin ( kCommand , ' ' ) ) ;
40
41
const 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' ) ;
42
45
ArrayPrototypePushApply ( args , kCommand ) ;
43
46
44
47
const watcher = new FilesWatcher ( { throttle : 500 , mode : kShouldFilterModules ? 'filter' : 'all' } ) ;
@@ -50,7 +53,7 @@ let exited;
50
53
51
54
function start ( ) {
52
55
exited = false ;
53
- const stdio = kShouldFilterModules ? [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] : undefined ;
56
+ const stdio = kShouldFilterModules ? [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] : 'inherit' ;
54
57
child = spawn ( process . execPath , args , { stdio, env : { ...process . env , WATCH_REPORT_DEPENDENCIES : '1' } } ) ;
55
58
watcher . watchChildProcessModules ( child ) ;
56
59
child . once ( 'exit' , ( code ) => {
0 commit comments