Skip to content

Commit

Permalink
watch: use primordials and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rluvaton committed Apr 4, 2024
1 parent 57756e8 commit dbf6246
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/internal/main/watch_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ const {
ArrayPrototypeForEach,
ArrayPrototypeJoin,
ArrayPrototypeMap,
ArrayPrototypePush,
ArrayPrototypePushApply,
ArrayPrototypeSlice,
StringPrototypeIncludes,
StringPrototypeStartsWith,
} = primordials;

const {
Expand Down Expand Up @@ -40,13 +43,13 @@ const argsWithoutWatchOptions = [];

for (let i = 0; i < process.execArgv.length; i++) {
const arg = process.execArgv[i];
if (arg.startsWith('--watch')) {
if(!arg.includes('=')) {
if (StringPrototypeStartsWith(arg, '--watch')) {
if (!StringPrototypeIncludes(arg, '=')) {
i++;
}
continue;
}
argsWithoutWatchOptions.push(arg);
ArrayPrototypePush(argsWithoutWatchOptions, arg);
}

ArrayPrototypePushApply(argsWithoutWatchOptions, kCommand);
Expand All @@ -61,7 +64,13 @@ let exited;
function start() {
exited = false;
const stdio = kShouldFilterModules ? ['inherit', 'inherit', 'inherit', 'ipc'] : 'inherit';
child = spawn(process.execPath, argsWithoutWatchOptions, { stdio, env: { ...process.env, WATCH_REPORT_DEPENDENCIES: '1' } });
child = spawn(process.execPath, argsWithoutWatchOptions, {
stdio,
env: {
...process.env,
WATCH_REPORT_DEPENDENCIES: '1',
},
});
watcher.watchChildProcessModules(child);
child.once('exit', (code) => {
exited = true;
Expand Down

0 comments on commit dbf6246

Please sign in to comment.