(child: ChildProcess)
| 271 | } |
| 272 | |
| 273 | function killChild(child: ChildProcess): void { |
| 274 | // On Windows, `ChildProcess.kill()` only signals the direct child (e.g. the |
| 275 | // `cmd.exe` wrapper when `shell` is involved, or the `git`/`gh` parent), |
| 276 | // leaving grandchildren alive and holding the cwd. Terminate the whole |
| 277 | // process tree so the working directory is released promptly. |
| 278 | if (process.platform === 'win32' && child.pid !== undefined) { |
| 279 | try { |
| 280 | const killer = spawn('taskkill', ['/T', '/F', '/PID', String(child.pid)], { |
| 281 | stdio: 'ignore', |
| 282 | windowsHide: true, |
| 283 | }); |
| 284 | killer.once('error', () => {}); |
| 285 | return; |
| 286 | } catch { |
| 287 | // fall through to the direct kill below |
| 288 | } |
| 289 | } |
| 290 | try { |
| 291 | child.kill(); |
| 292 | } catch {} |
| 293 | } |
| 294 | |
| 295 | function parsePullRequest(stdout: string): FsPullRequest | null { |
| 296 | let raw: unknown; |
no test coverage detected