From 8a53b55f3a83f3bdf3b231f90e766fc15ec51895 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 3 Feb 2011 11:02:20 +0100
Subject: [PATCH] Fix handling of ^C in the CLI scripts

This adds a message and nice handling of ^C, especially useful for
``gnt-job watch``.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/cli.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/cli.py b/lib/cli.py
index e9576db0e..09119fe90 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -1928,6 +1928,11 @@ def GenericMain(commands, override=None, aliases=None):
     result, err_msg = FormatError(err)
     logging.exception("Error during command processing")
     ToStderr(err_msg)
+  except KeyboardInterrupt:
+    result = constants.EXIT_FAILURE
+    ToStderr("Aborted. Note that if the operation created any jobs, they"
+             " might have been submitted and"
+             " will continue to run in the background.")
 
   return result
 
-- 
GitLab