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.

terminal: Kill entire process group on Unix when stopping command (#45993)

Serhii Melnychuk01b716cf1219
diff --git a/crates/terminal/src/pty_info.rs b/crates/terminal/src/pty_info.rs
index c92de2f23b8..60654378d9e 100644
--- a/crates/terminal/src/pty_info.rs
+++ b/crates/terminal/src/pty_info.rs
@@ -125,6 +125,15 @@ impl PtyProcessInfo {
self.system.process(pid)
}
+ #[cfg(unix)]
+ pub(crate) fn kill_current_process(&mut self) -> bool {
+ let Some(pid) = self.pid_getter.pid() else {
+ return false;
+ };
+ unsafe { libc::killpg(pid.as_u32() as i32, libc::SIGKILL) == 0 }
+ }
+
+ #[cfg(not(unix))]
pub(crate) fn kill_current_process(&mut self) -> bool {
self.refresh().is_some_and(|process| process.kill())
}