diff options
author | Pradeep Kumar K J <pradeepkumar.kj@softwareag.com> | 2022-03-07 04:04:56 -0800 |
---|---|---|
committer | Pradeep Kumar K J <pradeepkumar.kj@softwareag.com> | 2022-03-11 00:22:33 -0800 |
commit | 816fd5ceebd88e5661ec136fc952d05673ed23f2 (patch) | |
tree | ea1989b00574c358b83d36a434d058a4bffbd6f3 /plugins/tedge_apt_plugin | |
parent | 2e98c65e610bfa23dd74433ac75e1b1674dc7fa7 (diff) |
[955] over write the clap exit code
Diffstat (limited to 'plugins/tedge_apt_plugin')
-rw-r--r-- | plugins/tedge_apt_plugin/src/main.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/tedge_apt_plugin/src/main.rs b/plugins/tedge_apt_plugin/src/main.rs index 93ded974..cd74fe60 100644 --- a/plugins/tedge_apt_plugin/src/main.rs +++ b/plugins/tedge_apt_plugin/src/main.rs @@ -235,7 +235,14 @@ fn run_cmd(cmd: &str, args: &str) -> Result<ExitStatus, InternalError> { fn main() { // On usage error, the process exits with a status code of 1 - let apt = AptCli::parse(); + + let apt = match AptCli::try_parse() { + Ok(aptcli) => aptcli, + Err(_e) => { + // re-write the clap exit_status from 2 to 1, if parse fails + std::process::exit(1) + } + }; match run(apt.operation) { Ok(status) if status.success() => { |