( child: ChildProcess, force: boolean = false )
| 144 | } |
| 145 | |
| 146 | export async function killProcessByChildProcess( |
| 147 | child: ChildProcess, |
| 148 | force: boolean = false |
| 149 | ): Promise<boolean> { |
| 150 | const pid = child.pid; |
| 151 | if (!pid) { |
| 152 | return false; |
| 153 | } |
| 154 | |
| 155 | if (isWindows()) { |
| 156 | // Windows taskkill /T already kills the entire process tree |
| 157 | return killProcess(pid, force); |
| 158 | } |
| 159 | |
| 160 | // Kill entire process tree on Unix to prevent orphan processes |
| 161 | return killProcessTree(pid, force); |
| 162 | } |
no test coverage detected