(pid: number, signal: NodeJS.Signals)
| 87 | } |
| 88 | |
| 89 | function signalProcess(pid: number, signal: NodeJS.Signals): void { |
| 90 | // Harness processes are spawned detached as their own group leader, so the |
| 91 | // group (-pid) covers the CLI and any children it spawned. |
| 92 | try { |
| 93 | if (process.platform !== "win32") { |
| 94 | process.kill(-pid, signal) |
| 95 | return |
| 96 | } |
| 97 | } catch { |
| 98 | // Fall through to direct-pid kill if the group is already gone. |
| 99 | } |
| 100 | try { |
| 101 | process.kill(pid, signal) |
| 102 | } catch { |
| 103 | // Already exited. |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /** Terminate the given orphan pids (SIGTERM, then SIGKILL for survivors). */ |
| 108 | export function killOrphanHarnessPids(pids: number[]): void { |
no test coverage detected