diff --git a/packages/tauri-app/src-tauri/src/cli_manager.rs b/packages/tauri-app/src-tauri/src/cli_manager.rs index d4074b1d..4d96f540 100644 --- a/packages/tauri-app/src-tauri/src/cli_manager.rs +++ b/packages/tauri-app/src-tauri/src/cli_manager.rs @@ -17,10 +17,23 @@ use std::thread; use std::time::{Duration, Instant}; use tauri::{webview::cookie::Cookie, AppHandle, Emitter, Manager, Url}; +#[cfg(windows)] +use std::os::windows::process::CommandExt; + +#[cfg(windows)] +const CREATE_NO_WINDOW: u32 = 0x08000000; + fn log_line(message: &str) { println!("[tauri-cli] {message}"); } +fn configure_spawn(command: &mut Command) { + #[cfg(windows)] + { + command.creation_flags(CREATE_NO_WINDOW); + } +} + fn workspace_root() -> Option { std::env::current_dir().ok().and_then(|mut dir| { for _ in 0..3 { @@ -456,6 +469,7 @@ impl CliProcessManager { .env("ELECTRON_RUN_AS_NODE", "1") .stdout(Stdio::piped()) .stderr(Stdio::piped()); + configure_spawn(&mut c); if let Some(ref cwd) = cwd { c.current_dir(cwd); } @@ -468,6 +482,7 @@ impl CliProcessManager { .env("ELECTRON_RUN_AS_NODE", "1") .stdout(Stdio::piped()) .stderr(Stdio::piped()); + configure_spawn(&mut c); if let Some(ref cwd) = cwd { c.current_dir(cwd); }