windows: Fix popup window when using external command (#15547)

张小白 , shenjack , and Mikayla Maki created

Thanks techs-sus on Discord.


Co-authored-by: shenjack <3695888@qq.com>
Co-authored-by: techs-sus <discord>


Release Notes:

- N/A

Co-authored-by: shenjack <3695888@qq.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>

Change summary

Cargo.lock                    | 1 +
crates/project/Cargo.toml     | 3 +++
crates/project/src/project.rs | 5 +++++
3 files changed, 9 insertions(+)

Detailed changes

Cargo.lock 🔗

@@ -8323,6 +8323,7 @@ dependencies = [
  "unindent",
  "util",
  "which 6.0.3",
+ "windows 0.58.0",
  "worktree",
 ]
 

crates/project/Cargo.toml 🔗

@@ -71,6 +71,9 @@ text.workspace = true
 util.workspace = true
 which.workspace = true
 
+[target.'cfg(target_os = "windows")'.dependencies]
+windows.workspace = true
+
 [dev-dependencies]
 client = { workspace = true, features = ["test-support"] }
 collections = { workspace = true, features = ["test-support"] }

crates/project/src/project.rs 🔗

@@ -5449,6 +5449,11 @@ impl Project {
         })?;
 
         let mut child = smol::process::Command::new(command);
+        #[cfg(target_os = "windows")]
+        {
+            use smol::process::windows::CommandExt;
+            child.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);
+        }
 
         if let Some(working_dir_path) = working_dir_path {
             child.current_dir(working_dir_path);