Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

ssh remoting: Kill SSH master process when dropping client (#18331)

Thorsten Ball300bf87f77d3
diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rs
index 9d9d916f19b..06a7f810e67 100644
--- a/crates/remote/src/ssh_session.rs
+++ b/crates/remote/src/ssh_session.rs
@@ -56,7 +56,7 @@ pub struct SshSession {
struct SshClientState {
socket: SshSocket,
- _master_process: process::Child,
+ master_process: process::Child,
_temp_dir: TempDir,
}
@@ -593,7 +593,7 @@ impl SshClientState {
connection_options,
socket_path,
},
- _master_process: master_process,
+ master_process,
_temp_dir: temp_dir,
})
}
@@ -716,6 +716,14 @@ impl SshClientState {
}
}
+impl Drop for SshClientState {
+ fn drop(&mut self) {
+ if let Err(error) = self.master_process.kill() {
+ log::error!("failed to kill SSH master process: {}", error);
+ }
+ }
+}
+
impl SshSocket {
fn ssh_command<S: AsRef<OsStr>>(&self, program: S) -> process::Command {
let mut command = process::Command::new("ssh");