fix(git): avoid Windows tree kills after the command has exited (#20606)

Validated and independently reviewed OMP integration fix.
This commit is contained in:
Neil
2026-09-14 13:56:25 -07:00
committed by GitHub
parent fc4519cda4
commit ee1a0a4e2d
3 changed files with 149 additions and 0 deletions
@@ -9,6 +9,11 @@ export function killSpawnedCommandTree(child: ChildProcess): Promise<void> {
child.kill()
return Promise.resolve()
}
// Windows may reuse the pid after exit while inherited pipes still delay close.
if ((child.exitCode ?? null) !== null || (child.signalCode ?? null) !== null) {
child.kill()
return Promise.resolve()
}
if (
!admitSelfInitiatedTreeKill({ pid, site: 'git-command-tree-kill', scope: 'win-taskkill-tree' })
) {