cubicweb/cwctl.py
changeset 12696 eb83daa69495
parent 12692 8673da7c2f85
child 12735 17d1b1f4eddd
--- a/cubicweb/cwctl.py	Mon Jul 22 11:32:12 2019 +0200
+++ b/cubicweb/cwctl.py	Mon Jul 22 11:21:10 2019 +0200
@@ -150,9 +150,12 @@
                 appid, self.actionverb, ex))
             status = 8
 
-        except (KeyboardInterrupt, SystemExit):
+        except (KeyboardInterrupt, SystemExit) as ex:
             sys.stderr.write('%s aborted\n' % self.name)
-            status = 2  # specific error code
+            if isinstance(ex, KeyboardInterrupt):
+                status = 2  # specific error code
+            else:
+                status = ex.code
 
         if status != 0 and self.config.pdb:
             exception_type, exception, traceback_ = sys.exc_info()