From 468d878d564348b9b3749e1aa1f29ea7a3a2e947 Mon Sep 17 00:00:00 2001 From: David Anthoff Date: Tue, 14 Nov 2023 16:16:43 -0800 Subject: [PATCH] Return full 32 bit exit code from julialauncher --- src/bin/julialauncher.rs | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/bin/julialauncher.rs b/src/bin/julialauncher.rs index 4e1e1cf8..01336d16 100644 --- a/src/bin/julialauncher.rs +++ b/src/bin/julialauncher.rs @@ -346,29 +346,32 @@ fn run_app() -> Result { } fn main() -> Result { - human_panic::setup_panic!(human_panic::Metadata { - name: "Juliaup launcher".into(), - version: env!("CARGO_PKG_VERSION").into(), - authors: "".into(), - homepage: "https://github.com/JuliaLang/juliaup".into(), - }); + let client_status: std::prelude::v1::Result; - let env = env_logger::Env::new() - .filter("JULIAUP_LOG") - .write_style("JULIAUP_LOG_STYLE"); - env_logger::init_from_env(env); + { + human_panic::setup_panic!(human_panic::Metadata { + name: "Juliaup launcher".into(), + version: env!("CARGO_PKG_VERSION").into(), + authors: "".into(), + homepage: "https://github.com/JuliaLang/juliaup".into(), + }); - let client_status = run_app(); + let env = env_logger::Env::new() + .filter("JULIAUP_LOG") + .write_style("JULIAUP_LOG_STYLE"); + env_logger::init_from_env(env); - if let Err(err) = &client_status { - if let Some(e) = err.downcast_ref::() { - eprintln!("{}", e.msg); + client_status = run_app(); - return Ok(std::process::ExitCode::FAILURE); + if let Err(err) = &client_status { + if let Some(e) = err.downcast_ref::() { + eprintln!("{}", e.msg); + + return Ok(std::process::ExitCode::FAILURE); + } } } - let client_status: u8 = client_status?.try_into().unwrap(); - - Ok(std::process::ExitCode::from(client_status)) + // TODO https://github.com/rust-lang/rust/issues/111688 is finalized, we should use that instead of calling exit + std::process::exit(client_status?); }