cubicweb/cwctl.py
changeset 12696 eb83daa69495
parent 12692 8673da7c2f85
child 12735 17d1b1f4eddd
equal deleted inserted replaced
12695:38dfd90c335a 12696:eb83daa69495
   148 
   148 
   149             sys.stderr.write('instance %s not %s: %s\n' % (
   149             sys.stderr.write('instance %s not %s: %s\n' % (
   150                 appid, self.actionverb, ex))
   150                 appid, self.actionverb, ex))
   151             status = 8
   151             status = 8
   152 
   152 
   153         except (KeyboardInterrupt, SystemExit):
   153         except (KeyboardInterrupt, SystemExit) as ex:
   154             sys.stderr.write('%s aborted\n' % self.name)
   154             sys.stderr.write('%s aborted\n' % self.name)
   155             status = 2  # specific error code
   155             if isinstance(ex, KeyboardInterrupt):
       
   156                 status = 2  # specific error code
       
   157             else:
       
   158                 status = ex.code
   156 
   159 
   157         if status != 0 and self.config.pdb:
   160         if status != 0 and self.config.pdb:
   158             exception_type, exception, traceback_ = sys.exc_info()
   161             exception_type, exception, traceback_ = sys.exc_info()
   159             pdb = get_pdb()
   162             pdb = get_pdb()
   160             pdb.post_mortem(traceback_)
   163             pdb.post_mortem(traceback_)