From 0881e548deca2193218a68b6dc46330cecf30024 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 7 Nov 2025 21:56:43 +0100 Subject: [PATCH] terminal: Spawn terminal process on main thread on unix (#42234) Otherwise the terminal will not process the signals correctly Release Notes: - Fixed ctrl+c and friends not working in the terminal on macOS and linux --- crates/terminal/src/terminal.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 0550e4512a2c7594fc27dae37448cf6a09a5606a..6ec5cd9ab8d6231c4a62549142901beb02a660c0 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -426,7 +426,7 @@ impl TerminalBuilder { activation_script: Vec, ) -> Task> { let version = release_channel::AppVersion::global(cx); - cx.background_spawn(async move { + let fut = async move { // If the parent environment doesn't have a locale set // (As is the case when launched from a .app on MacOS), // and the Project doesn't have a locale set, then @@ -648,7 +648,13 @@ impl TerminalBuilder { terminal, events_rx, }) - }) + }; + // the thread we spawn things on has an effect on signal handling + if cfg!(target_os = "unix") { + cx.spawn(async move |_| fut.await) + } else { + cx.background_spawn(fut) + } } pub fn subscribe(mut self, cx: &Context) -> Terminal {