Skip to content

Commit 16dc027

Browse files
authored
Merge pull request #1333 from cesfahani/fix_zombie_ssh_procs
Fix zombie ssh processes from accumulating
2 parents 37732fb + 6118c5c commit 16dc027

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-transport/src/client/blocking_io/file.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ impl client::TransportWithoutIO for SpawnProcessOnDemand {
126126
}
127127
}
128128

129+
impl Drop for SpawnProcessOnDemand {
130+
fn drop(&mut self) {
131+
if let Some(mut child) = self.child.take() {
132+
// The child process (e.g. `ssh`) may still be running at this point, so kill it before joining/waiting.
133+
// In the happy-path case, it should have already exited gracefully, but in error cases or if the user
134+
// interrupted the operation, it will likely still be running.
135+
child.kill().ok();
136+
child.wait().ok();
137+
}
138+
}
139+
}
140+
129141
struct ReadStdoutFailOnError {
130142
recv: std::sync::mpsc::Receiver<std::io::Error>,
131143
read: std::process::ChildStdout,

0 commit comments

Comments
 (0)