[c-c instance commands] keyboard interrupt should stop the command, not jump to the next instance. Closes #1794850 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 01 Jul 2011 11:19:12 +0200
branchstable
changeset 7593 0c1024b3e7fc
parent 7592 c84436b79793
child 7594 d177c0755b10
[c-c instance commands] keyboard interrupt should stop the command, not jump to the next instance. Closes #1794850
cwctl.py
--- a/cwctl.py	Fri Jul 01 11:18:16 2011 +0200
+++ b/cwctl.py	Fri Jul 01 11:19:12 2011 +0200
@@ -152,16 +152,17 @@
                 print '*'*72
                 if not ASK.confirm('%s instance %r ?' % (self.name, appid)):
                     continue
-            status = max(status, self.run_arg(appid))
+            try:
+                status = max(status, self.run_arg(appid))
+            except (KeyboardInterrupt, SystemExit):
+                print >> sys.stderr, '%s aborted' % self.name
+                return 2 # specific error code
         sys.exit(status)
 
     def run_arg(self, appid):
         cmdmeth = getattr(self, '%s_instance' % self.name)
         try:
             status = cmdmeth(appid)
-        except (KeyboardInterrupt, SystemExit):
-            print >> sys.stderr, '%s aborted' % self.name
-            return 2 # specific error code
         except (ExecutionError, ConfigurationError), ex:
             print >> sys.stderr, 'instance %s not %s: %s' % (
                 appid, self.actionverb, ex)