fix: spawn new console window on Windows after self-update

This commit is contained in:
Helios Agent 2026-03-06 14:24:22 +01:00
parent 8e7b465538
commit cf6c1a076f
No known key found for this signature in database
GPG key ID: C8259547CD8309B5

View file

@ -712,8 +712,15 @@ async fn handle_message(
display::cmd_done("🔄", "update", "", true, "updated — restarting");
// Delete old binary
let _ = std::fs::remove_file(&old);
// Restart with same args
// Restart with same args (new console window on Windows)
let args: Vec<String> = 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();
}
#[cfg(not(target_os = "windows"))]
let _ = std::process::Command::new(&exe).args(&args).spawn();
std::process::exit(0);
});