summaryrefslogtreecommitdiffstats
path: root/plugins/tedge_apt_plugin
diff options
context:
space:
mode:
authorRina Fujino <18257209+rina23q@users.noreply.github.com>2022-03-11 10:20:19 +0100
committerGitHub <noreply@github.com>2022-03-11 10:20:19 +0100
commit3320206f27c347cf116a3ed368fc3ab7c96388c5 (patch)
tree809e42cf5e1f5f3d7c9c8deffa63f12140a56e5e /plugins/tedge_apt_plugin
parentaf11a275eb79124a4ff409381a05a6dc9bc2afda (diff)
parent816fd5ceebd88e5661ec136fc952d05673ed23f2 (diff)
Merge pull request #981 Overwrite the apt plugin exit code
[#955] Overwrite the apt plugin exit code aligned to specs
Diffstat (limited to 'plugins/tedge_apt_plugin')
-rw-r--r--plugins/tedge_apt_plugin/src/main.rs9
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() => {