From a3100a872b8e715e1836aeaa39561dc19c4b2fac Mon Sep 17 00:00:00 2001 From: Helios Agent Date: Fri, 6 Mar 2026 14:30:01 +0100 Subject: [PATCH] fix: delete .old.exe on startup + use cmd start for new window --- crates/client/src/main.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/client/src/main.rs b/crates/client/src/main.rs index 1a07545..58ceda2 100644 --- a/crates/client/src/main.rs +++ b/crates/client/src/main.rs @@ -221,6 +221,13 @@ async fn main() { banner(); + // Clean up leftover .old.exe from previous self-update (Windows can't delete running exe) + #[cfg(target_os = "windows")] + if let Ok(exe) = std::env::current_exe() { + let old = exe.with_extension("old.exe"); + let _ = std::fs::remove_file(&old); + } + // Single instance check if !acquire_instance_lock() { display::err("❌", "Another instance of helios-remote is already running."); @@ -716,9 +723,11 @@ async fn handle_message( let args: Vec = std::env::args().skip(1).collect(); #[cfg(target_os = "windows")] { - use std::os::windows::process::CommandExt; - const CREATE_NEW_CONSOLE: u32 = 0x00000010; - let _ = std::process::Command::new(&exe).args(&args).creation_flags(CREATE_NEW_CONSOLE).spawn(); + // Use "start" to open a new visible console window + let exe_str = exe.to_string_lossy(); + let _ = std::process::Command::new("cmd") + .args(["/c", "start", "", &exe_str]) + .spawn(); } #[cfg(not(target_os = "windows"))] let _ = std::process::Command::new(&exe).args(&args).spawn();