Skip to content

Commit

Permalink
Exit with ExitCode instead of syscall
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Gunnerson <[email protected]>
  • Loading branch information
chenxiaolong committed Sep 2, 2024
1 parent 9f12a37 commit 7b61f95
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
collections::HashSet,
process::ExitCode,
sync::Arc,
time::Duration,
};
Expand Down Expand Up @@ -209,15 +210,15 @@ async fn main_wrapper() -> Result<(), MainError> {
}

#[tokio::main]
async fn main() {
async fn main() -> ExitCode {
match main_wrapper().await {
Ok(_) => {}
Ok(_) => ExitCode::SUCCESS,
Err(e) => {
match e {
MainError::Unprinted(e) => eprintln!("{e}"),
MainError::AlreadyPrinted => {}
}
std::process::exit(1);
ExitCode::FAILURE
}
}
}

0 comments on commit 7b61f95

Please sign in to comment.