From 8cbd515e0c1a4b9d30aed7089ce64c79c1bda6e7 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 7 Apr 2022 16:38:51 -0700 Subject: [PATCH] Treat ^C as "no" at confirmation prompt The user intent is clear. Change-Id: Ibdaa2f95e7417619f651d6f41fbf15a357839bf3 --- git_review/cmd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git_review/cmd.py b/git_review/cmd.py index b3e7e38e..b0878679 100644 --- a/git_review/cmd.py +++ b/git_review/cmd.py @@ -968,7 +968,10 @@ def assert_one_change(remote, branch, yes, have_hook): "branches (for independent changes).") print("\nThe outstanding commits are:\n\n%s\n\n" "Do you really want to submit the above commits?" % output) - yes_no = input("Type 'yes' to confirm, other to cancel: ") + try: + yes_no = input("Type 'yes' to confirm, other to cancel: ") + except KeyboardInterrupt: + yes_no = "no" if yes_no.lower().strip() != "yes": print("Aborting.") sys.exit(1)