From 88da59efd9044c808e31393d7217e559ad5917d5 Mon Sep 17 00:00:00 2001 From: Jordan Mackie Date: Tue, 28 Feb 2023 16:25:07 +0000 Subject: [PATCH] Move `set_hook` calls to sync main --- crates/ditto-cli/src/main.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/ditto-cli/src/main.rs b/crates/ditto-cli/src/main.rs index 1b25789e9..a8a925571 100644 --- a/crates/ditto-cli/src/main.rs +++ b/crates/ditto-cli/src/main.rs @@ -71,14 +71,6 @@ async fn run(mut cmd: Command, matches: &ArgMatches, version: &Version) -> Resul #[tokio::main] async fn main() { - if let Err(err) = try_main().await { - eprintln!("{:?}", err); - std::process::exit(1); - } - std::process::exit(0); -} - -async fn try_main() -> Result<()> { // NOTE: this is here to catch any "internal compiler errors", // `unwrap`, `expect` (etc) which aren't _supposed_ to blow up std::panic::set_hook(Box::new(|panic_info| { @@ -100,6 +92,14 @@ async fn try_main() -> Result<()> { })) .expect("Error installing miette hook"); + if let Err(err) = try_main().await { + eprintln!("{:?}", err); + std::process::exit(1); + } + std::process::exit(0); +} + +async fn try_main() -> Result<()> { let version = Version::from_env(); let version_short = version.render_short(); let version_long = version.render_long();