Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
Move set_hook calls to sync main
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Mackie committed Mar 1, 2023
1 parent 9cbfc7f commit 88da59e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/ditto-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand All @@ -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();
Expand Down

0 comments on commit 88da59e

Please sign in to comment.