diff -r 38dfd90c335a -r eb83daa69495 cubicweb/cwctl.py --- 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()