fix: spawn new console window on Windows after self-update
This commit is contained in:
parent
8e7b465538
commit
cf6c1a076f
1 changed files with 8 additions and 1 deletions
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue