Fix Ctrl+C not working when Zed is launched from CLI (#39482)

Closes https://github.com/zed-industries/zed/issues/38383
Closes https://github.com/zed-industries/zed/issues/39330

Release Notes:

- N/A
This commit is contained in:
John Tur
2025-10-06 20:35:44 +00:00
committed by GitHub
parent 94f1faffa7
commit b2f0b1b168
2 changed files with 3 additions and 8 deletions
+1 -5
View File
@@ -1,5 +1,4 @@
use std::{
os::windows::process::CommandExt,
path::Path,
time::{Duration, Instant},
};
@@ -7,7 +6,6 @@ use std::{
use anyhow::{Context as _, Result};
use windows::Win32::{
Foundation::{HWND, LPARAM, WPARAM},
System::Threading::CREATE_NEW_PROCESS_GROUP,
UI::WindowsAndMessaging::PostMessageW,
};
@@ -207,9 +205,7 @@ pub(crate) fn perform_update(app_dir: &Path, hwnd: Option<isize>, launch: bool)
}
if launch {
#[allow(clippy::disallowed_methods, reason = "doesn't run in the main binary")]
let _ = std::process::Command::new(app_dir.join("Zed.exe"))
.creation_flags(CREATE_NEW_PROCESS_GROUP.0)
.spawn();
let _ = std::process::Command::new(app_dir.join("Zed.exe")).spawn();
}
log::info!("Update completed successfully");
Ok(())
+2 -3
View File
@@ -731,15 +731,15 @@ mod windows {
Storage::FileSystem::{
CreateFileW, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, OPEN_EXISTING, WriteFile,
},
System::Threading::{CREATE_NEW_PROCESS_GROUP, CreateMutexW},
System::Threading::CreateMutexW,
},
core::HSTRING,
};
use crate::{Detect, InstalledApp};
use std::io;
use std::path::{Path, PathBuf};
use std::process::ExitStatus;
use std::{io, os::windows::process::CommandExt};
fn check_single_instance() -> bool {
let mutex = unsafe {
@@ -778,7 +778,6 @@ mod windows {
fn launch(&self, ipc_url: String) -> anyhow::Result<()> {
if check_single_instance() {
std::process::Command::new(self.0.clone())
.creation_flags(CREATE_NEW_PROCESS_GROUP.0)
.arg(ipc_url)
.spawn()?;
} else {