[libvirt] [jenkins-ci PATCH 2/3] lcitool: push exception catching down into run method

Daniel P. Berrangé berrange at redhat.com
Tue Mar 12 10:49:26 UTC 2019


Signed-off-by: Daniel P. Berrangé <berrange at 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




More information about the libvir-list mailing list