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) ).
This commit is contained in:
张小白 2024-08-14 00:12:42 +08:00 committed by GitHub
parent fa51651d06
commit 03796e79b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 5 deletions

1
Cargo.lock generated
View File

@ -8832,6 +8832,7 @@ dependencies = [
"ui",
"util",
"uuid",
"windows 0.58.0",
"workspace",
]

View File

@ -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

View File

@ -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() {