From 36c68ff1f57d573f68c5d76f1b369c4e7b37b8fb Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 12 Dec 2007 15:18:10 +0000 Subject: [PATCH] Handle ^C while trying to acquire the lock 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cli.py b/lib/cli.py index 7a4d56c05..c10e7bbc1 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -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) -- GitLab