| 431 | |
| 432 | // helper function to kill process, uses taskkill on windows to ensure child process is killed too |
| 433 | export async function killProcess( |
| 434 | serverProcess: ExecaResultPromise, |
| 435 | ): Promise<void> { |
| 436 | if (isWindows) { |
| 437 | try { |
| 438 | const { execaCommandSync } = await import('execa') |
| 439 | execaCommandSync(`taskkill /pid ${serverProcess.pid} /T /F`) |
| 440 | } catch (e) { |
| 441 | console.error('failed to taskkill:', e) |
| 442 | } |
| 443 | } else { |
| 444 | serverProcess.kill('SIGTERM') |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | export interface PromiseWithResolvers<T> { |
| 449 | promise: Promise<T> |