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.

macos: Reset exception ports for shell-spawned processes (#44193)

Rémi Kalbe5bfc0baa4cd0
diff --git a/crates/util/src/command.rs b/crates/util/src/command.rs
index dde1603dfe2..40f1ec323f6 100644
--- a/crates/util/src/command.rs
+++ b/crates/util/src/command.rs
@@ -58,7 +58,7 @@ pub fn new_smol_command(program: impl AsRef<OsStr>) -> smol::process::Command {
}
#[cfg(target_os = "macos")]
-fn reset_exception_ports() {
+pub fn reset_exception_ports() {
use mach2::exception_types::{
EXC_MASK_ALL, EXCEPTION_DEFAULT, exception_behavior_t, exception_mask_t,
};
diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs
index 169da43b528..4ea35901963 100644
--- a/crates/util/src/util.rs
+++ b/crates/util/src/util.rs
@@ -390,6 +390,8 @@ pub fn set_pre_exec_to_start_new_session(
use std::os::unix::process::CommandExt;
command.pre_exec(|| {
libc::setsid();
+ #[cfg(target_os = "macos")]
+ crate::command::reset_exception_ports();
Ok(())
});
};