Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
guests/lcitool | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/guests/lcitool b/guests/lcitool
index 487b67d..2c86d07 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -690,12 +690,12 @@ class Application:
def run(self):
args = self._parser.parse_args()
- args.func(args)
+ try:
+ args.func(args)
+ except Exception as err:
+ sys.stderr.write("{}: {}\n".format(sys.argv[0], err))
+ sys.exit(1)
if __name__ == "__main__":
- try:
- Application().run()
- except Exception as err:
- sys.stderr.write("{}: {}\n".format(sys.argv[0], err))
- sys.exit(1)
+ Application().run()
--
2.20.1