(child: ChildProcess, signal: NodeJS.Signals)
| 47 | // Signal the process GROUP (negative pid); fall back to the direct child |
| 48 | // when the group is already gone. |
| 49 | const signalTree = (child: ChildProcess, signal: NodeJS.Signals) => { |
| 50 | if (child.pid === undefined || child.exitCode !== null) return; |
| 51 | try { |
| 52 | process.kill(-child.pid, signal); |
| 53 | } catch { |
| 54 | child.kill(signal); |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | const exited = (child: ChildProcess): Promise<void> => |
| 59 | child.exitCode !== null || child.signalCode !== null |