Only kill the Git process group when a command fails

The native Git runner SIGKILLed its child's process group after every
command, including successful ones. Git spawns credential-cache--daemon
into the same group, so each ls-remote or fetch destroyed the cache it
had just warmed and every later command re-ran the full helper chain.
Kill the group only on timeout, cancellation, or failure, and drop the
redundant kill/wait on an already-reaped child.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Scott Werner 2026-09-11 09:33:19 -06:00
parent 3e5b7df998
commit cd0127e81f

View file

@ -125,16 +125,17 @@ impl NativeGit {
Ok(stdout)
} => result,
};
// Helpers may inherit pipes or survive their Git parent. Terminate the
// owned process group on both completion and interruption, then reap Git.
#[cfg(unix)]
if let Some(id) = process_id {
fabro_proc::sigkill_process_group(id);
}
// A timed-out, cancelled, or failed Git may leave helpers running in
// its process group; terminate the group, then reap Git. A successful
// Git has closed its pipes, and helpers it deliberately left behind
// (such as `credential-cache--daemon`) keep serving later commands.
if result.is_err() {
#[cfg(unix)]
if let Some(id) = process_id {
fabro_proc::sigkill_process_group(id);
}
child.kill().await?;
}
child.wait().await?;
result
}