()
| 167 | |
| 168 | let stopping = false; |
| 169 | const stop = async (): Promise<void> => { |
| 170 | if (stopping) { |
| 171 | await child.exited; |
| 172 | return; |
| 173 | } |
| 174 | stopping = true; |
| 175 | for (const signal of viteChildSignals) process.off(signal, stopOnParentSignal); |
| 176 | if (child.exitCode === null) child.kill(); |
| 177 | await Promise.race([child.exited, Bun.sleep(5_000)]); |
| 178 | if (child.exitCode === null) child.kill("SIGKILL"); |
| 179 | await child.exited; |
| 180 | }; |
| 181 | const stopOnParentSignal = (): void => { |
| 182 | // A PTY/session teardown can signal the CLI while Vite is still optimizing |
| 183 | // dependencies, before the server's normal stop handle exists. Reap the |
no test coverage detected