log exit code and keep console open if it isn't 0

This commit is contained in:
2024-06-26 14:58:00 +02:00
parent 70ce839c86
commit 30c6d568b8

View File

@@ -470,13 +470,18 @@ async fn update(
fn launch(file_path: &PathBuf, args: &str) {
println!("\n\nJoin the AlterWare Discord server:\nhttps://discord.gg/2ETE8engZM\n\n");
crate::println_info!("Launching {} {}", file_path.display(), args);
std::process::Command::new(file_path)
let exit_status = std::process::Command::new(file_path)
.args(args.trim().split(' '))
.current_dir(file_path.parent().unwrap())
.spawn()
.expect("Failed to launch the game")
.wait()
.expect("Failed to wait for the game process to finish");
crate::println_error!("Game exited with status: {}", exit_status);
if !exit_status.success() {
misc::stdin();
}
}
#[cfg(windows)]