(proc, signal)
| 79 | } |
| 80 | |
| 81 | function terminateProcess(proc, signal) { |
| 82 | if (proc.exitCode != null) return; |
| 83 | |
| 84 | try { |
| 85 | if (!IS_WINDOWS && proc.pid) { |
| 86 | process.kill(-proc.pid, signal); |
| 87 | return; |
| 88 | } |
| 89 | } catch { |
| 90 | // Fall through to direct child kill. |
| 91 | } |
| 92 | |
| 93 | try { |
| 94 | proc.kill(signal); |
| 95 | } catch { |
| 96 | // Ignore already-exited children. |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | function sleep(ms) { |
| 101 | return new Promise((resolve) => setTimeout(resolve, ms)); |