MCPcopy Index your code
hub / github.com/nodejs/node / start

Function start

lib/internal/main/watch_mode.js:90–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88let stopping;
89
90function start() {
91 exited = false;
92 stopping = false;
93 const stdio = kShouldFilterModules ? ['inherit', 'inherit', 'inherit', 'ipc'] : 'inherit';
94 child = spawn(process.execPath, argsWithoutWatchOptions, {
95 stdio,
96 env: {
97 ...process.env,
98 WATCH_REPORT_DEPENDENCIES: '1',
99 },
100 });
101 watcher.watchChildProcessModules(child);
102 if (kEnvFiles.length > 0) {
103 ArrayPrototypeForEach(kEnvFiles, (file) => watcher.filterFile(resolve(file)));
104 }
105 if (kOptionalEnvFiles.length > 0) {
106 ArrayPrototypeForEach(kOptionalEnvFiles,
107 (file) => watcher.filterFile(resolve(file), undefined, { allowMissing: true }));
108 }
109 childExitPromise = once(child, 'exit').then(({ 0: code }) => {
110 exited = true;
111 if (stopping) {
112 return code;
113 }
114 const waitingForChanges = 'Waiting for file changes before restarting...';
115 if (code === 0) {
116 process.stdout.write(`${blue}Completed running ${kCommandStr}. ${waitingForChanges}${white}\n`);
117 } else {
118 process.stdout.write(`${red}Failed running ${kCommandStr}. ${waitingForChanges}${white}\n`);
119 }
120 return code;
121 });
122 return child;
123}
124
125async function killAndWait(signal = kKillSignal, force = false) {
126 const processToKill = child;

Callers 2

restartFunction · 0.70
initFunction · 0.70

Calls 7

filterFileMethod · 0.80
spawnFunction · 0.50
resolveFunction · 0.50
onceFunction · 0.50
thenMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…