Skip to content

Commit

Permalink
Be consistent with Routinator in terms of exit code on --version or -…
Browse files Browse the repository at this point in the history
…-help.
  • Loading branch information
ximon18 committed Oct 24, 2023
1 parent d217071 commit 097f569
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::{crate_authors, crate_version, Command};
use clap::{crate_authors, crate_version, error::ErrorKind, Command};
use futures::{
future::{select, Either},
pin_mut,
Expand Down Expand Up @@ -28,7 +28,10 @@ fn run_with_cmdline_args() -> Result<(), Terminate> {
let config_args = Config::config_args(app);
let matches = config_args.try_get_matches().map_err(|err| {
let _ = err.print();
Terminate::other(2)
match err.kind() {
ErrorKind::DisplayHelp | ErrorKind::DisplayVersion => Terminate::normal(),
_ => Terminate::other(2),
}
})?;

let cur_dir = current_dir().map_err(|err| {
Expand Down Expand Up @@ -101,8 +104,10 @@ async fn handle_signals(config_source: Source, mut manager: Manager) -> Result<(
}
}
} else {
info!("SIGHUP signal received, nothing to do. No \
configuration file specified to re-read (default used).");
info!(
"SIGHUP signal received, nothing to do. No \
configuration file specified to re-read (default used)."
);
}
}
Either::Right((Err(err), _)) => {
Expand Down

0 comments on commit 097f569

Please sign in to comment.