Skip to content

Commit 0b2e62a

Browse files
author
Anmol Mishra
committed
fix(desktop): add CREATE_NO_WINDOW flag to prevent console window flash on Windows
Add CREATE_NO_WINDOW to std::process::Command calls in probe_shell_env and sync_cli on Windows. Without this flag, subprocess invocations (git polling, shell env probing, CLI version checks) cause a visible black console window to flash on screen at regular intervals even when the app is idle. Fixes anomalyco#22414
1 parent 5b60e51 commit 0b2e62a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • packages/desktop/src-tauri/src

‎packages/desktop/src-tauri/src/cli.rs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,11 @@ pub fn sync_cli(app: tauri::AppHandle) -> Result<(), String> {
182182
let cli_path =
183183
get_cli_install_path().ok_or_else(|| "Could not determine CLI install path".to_string())?;
184184

185-
let output = std::process::Command::new(&cli_path)
186-
.arg("--version")
185+
let mut cmd = std::process::Command::new(&cli_path);
186+
cmd.arg("--version");
187+
#[cfg(windows)]
188+
cmd.creation_flags(CREATE_NO_WINDOW);
189+
let output = cmd
187190
.output()
188191
.map_err(|e| format!("Failed to get CLI version: {}", e))?;
189192

@@ -288,6 +291,10 @@ fn probe_shell_env(shell: &str, mode: &str) -> ShellEnvProbe {
288291
cmd.stdin(Stdio::null());
289292
cmd.stdout(Stdio::piped());
290293
cmd.stderr(Stdio::null());
294+
#[cfg(windows)]
295+
{
296+
cmd.creation_flags(CREATE_NO_WINDOW);
297+
}
291298
let output = match command_output_with_timeout(cmd, SHELL_ENV_TIMEOUT) {
292299
Ok(Some(output)) => output,
293300
Ok(None) => return ShellEnvProbe::Timeout,

0 commit comments

Comments
 (0)