()
| 88 | let stopping; |
| 89 | |
| 90 | function 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 | |
| 125 | async function killAndWait(signal = kKillSignal, force = false) { |
| 126 | const processToKill = child; |
no test coverage detected
searching dependent graphs…