Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
repl: Don't show cmd window on Windows (#16016)
张小白03796e79b00c
diff --git a/Cargo.lock b/Cargo.lockindex 8664b200484..fd11771ae5c 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.tomlindex 81eeb2ab5eb..001bf157d54 100644--- a/crates/repl/Cargo.toml+++ b/crates/repl/Cargo.toml@@ -43,6 +43,9 @@ util.workspace = trueuuid.workspace = trueworkspace.workspace = true+[target.'cfg(target_os = "windows")'.dependencies]+windows.workspace = true+[dev-dependencies]editor = { workspace = true, features = ["test-support"] }env_logger.workspace = truediff --git a/crates/repl/src/kernels.rs b/crates/repl/src/kernels.rsindex 3868d41baa8..a4764196544 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<dyn Fs>) -> Result<Vec<KernelSpecific}// Search for kernels inside the base python environment- let command = Command::new("python")- .arg("-c")- .arg("import sys; print(sys.prefix)")- .output()- .await;+ let mut command = Command::new("python");+ command.arg("-c");+ command.arg("import sys; print(sys.prefix)");++ #[cfg(windows)]+ {+ use smol::process::windows::CommandExt;+ command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);+ }++ let command = command.output().await;if let Ok(command) = command {if command.status.success() {