Skip to content

Commit

Permalink
Don't exit process in run() on argument parse error (#2176)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Jun 20, 2024
1 parent aa43a66 commit e4564f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/run.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::*;

/// Main entry point into `just`. Parse arguments from `args` and run. `run()`
/// will exit the proceess if `args` cannot be parsed.
/// Main entry point into `just`. Parse arguments from `args` and run.
#[allow(clippy::missing_errors_doc)]
pub fn run(args: impl Iterator<Item = impl Into<OsString> + Clone>) -> Result<(), i32> {
#[cfg(windows)]
Expand All @@ -18,7 +17,10 @@ pub fn run(args: impl Iterator<Item = impl Into<OsString> + Clone>) -> Result<()
let app = Config::app();

info!("Parsing command line arguments…");
let matches = app.get_matches_from(args);
let matches = app.try_get_matches_from(args).map_err(|err| {
err.print().ok();
err.exit_code()
})?;

let config = Config::from_matches(&matches).map_err(Error::from);

Expand Down

0 comments on commit e4564f4

Please sign in to comment.