From 03796e79b00c2065925c1c06a9b52187365f1f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Wed, 14 Aug 2024 00:12:42 +0800 Subject: [PATCH] repl: Don't show cmd window on Windows (#16016) Closes #15955 . Release Notes: - Fixed `cmd` window showing when repl executing commands([#15955](https://github.com/zed-industries/zed/issues/15955) ). --- Cargo.lock | 1 + crates/repl/Cargo.toml | 3 +++ crates/repl/src/kernels.rs | 22 +++++++++++++++++----- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8664b20048..fd11771ae5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8832,6 +8832,7 @@ dependencies = [ "ui", "util", "uuid", + "windows 0.58.0", "workspace", ] diff --git a/crates/repl/Cargo.toml b/crates/repl/Cargo.toml index 81eeb2ab5e..001bf157d5 100644 --- a/crates/repl/Cargo.toml +++ b/crates/repl/Cargo.toml @@ -43,6 +43,9 @@ util.workspace = true uuid.workspace = true workspace.workspace = true +[target.'cfg(target_os = "windows")'.dependencies] +windows.workspace = true + [dev-dependencies] editor = { workspace = true, features = ["test-support"] } env_logger.workspace = true diff --git a/crates/repl/src/kernels.rs b/crates/repl/src/kernels.rs index 3868d41baa..a476419654 100644 --- a/crates/repl/src/kernels.rs +++ b/crates/repl/src/kernels.rs @@ -55,6 +55,12 @@ impl KernelSpecification { cmd.envs(env); } + #[cfg(windows)] + { + use smol::process::windows::CommandExt; + cmd.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0); + } + Ok(cmd) } } @@ -395,11 +401,17 @@ pub async fn kernel_specifications(fs: Arc) -> Result