From a98c648201b009c7ff13d7cbe46810f95947f799 Mon Sep 17 00:00:00 2001 From: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> Date: Thu, 24 Apr 2025 16:46:25 -0400 Subject: [PATCH] debugger: Fix spawned debug adapters taking over Zed's shell (#29373) This fixes a bug where Zed wasn't closable via ctl-c in the shell it was spawned in after starting a debug adapter Release Notes: - N/A Co-authored-by: Conrad Irwin --- crates/dap/src/transport.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/dap/src/transport.rs b/crates/dap/src/transport.rs index 1e2a8badaf96e92ae2168b3c27ecd02418c3485f..224b08d62b8f625f758ca56208bb35e691be5553 100644 --- a/crates/dap/src/transport.rs +++ b/crates/dap/src/transport.rs @@ -552,7 +552,9 @@ impl TcpTransport { let host = connection_args.host; let port = connection_args.port; - let mut command = util::command::new_smol_command(&binary.command); + let mut command = util::command::new_std_command(&binary.command); + util::set_pre_exec_to_start_new_session(&mut command); + let mut command = smol::process::Command::from(command); if let Some(cwd) = &binary.cwd { command.current_dir(cwd); @@ -636,7 +638,9 @@ pub struct StdioTransport { impl StdioTransport { #[allow(dead_code, reason = "This is used in non test builds of Zed")] async fn start(binary: &DebugAdapterBinary, _: AsyncApp) -> Result<(TransportPipe, Self)> { - let mut command = util::command::new_smol_command(&binary.command); + let mut command = util::command::new_std_command(&binary.command); + util::set_pre_exec_to_start_new_session(&mut command); + let mut command = smol::process::Command::from(command); if let Some(cwd) = &binary.cwd { command.current_dir(cwd);