Handle ^C while trying to acquire the lock
authorIustin Pop <iustin@google.com>
Wed, 12 Dec 2007 15:18:10 +0000 (15:18 +0000)
committerIustin Pop <iustin@google.com>
Wed, 12 Dec 2007 15:18:10 +0000 (15:18 +0000)
When waiting for the lock and pressing ^C, the user will get a backtrace
as the KeyboardInterrupt exception is not handled. The patch adds a
simple method of handling it.

Note that this is not about ^C in any other place.

Reviewed-by: schreiberal,imsnah

lib/cli.py

index 7a4d56c..c10e7bb 100644 (file)
@@ -459,6 +459,9 @@ def GenericMain(commands, override=None):
   except errors.LockError, err:
     logger.ToStderr(str(err))
     return 1
+  except KeyboardInterrupt:
+    logger.ToStderr("Aborting.")
+    return 1
 
   if old_cmdline:
     logger.Info("run with arguments '%s'" % old_cmdline)