From 30c6d568b8c046ec518e24eb783f6a9f1008e3ea Mon Sep 17 00:00:00 2001 From: mxve <68632137+mxve@users.noreply.github.com> Date: Wed, 26 Jun 2024 14:58:00 +0200 Subject: [PATCH] log exit code and keep console open if it isn't 0 --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 529eab0..ab09564 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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)]