From: Michael Tremer Date: Wed, 8 Dec 2021 18:57:10 +0000 (+0000) Subject: pakfire: Don't throw an exception if execute fails X-Git-Tag: 0.9.28~850 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e2c1232ce1060585a2f60d025269bd80ca5720c;p=pakfire.git pakfire: Don't throw an exception if execute fails Signed-off-by: Michael Tremer --- diff --git a/src/scripts/pakfire.in b/src/scripts/pakfire.in index b77698e08..fdd21f26a 100644 --- a/src/scripts/pakfire.in +++ b/src/scripts/pakfire.in @@ -24,6 +24,7 @@ import logging import sys import pakfire +import pakfire.errors from pakfire.i18n import _ class Cli(object): @@ -316,8 +317,13 @@ class Cli(object): else: sys.stdout.write("%s\n" % line) - return p.execute(args.command, - interactive=args.interactive, logging_callback=logging_callback) + try: + return p.execute(args.command, + interactive=args.interactive, logging_callback=logging_callback) + + # Exit program with the command's exit code + except pakfire.errors.CommandExecutionError as e: + return e.args[0] def _info(self, p, args): for pkg in p.search(args.package, name_only=True):