From 8d9ba4a77257d011ce9a9df14f364ffca65499df Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 3 Dec 2018 13:53:13 +0530 Subject: [PATCH] Handle ctrl-c while paging help gracefully --- kitty/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kitty/cli.py b/kitty/cli.py index 6b7bc7cce..01ef04427 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -275,7 +275,10 @@ def print_help_for_seq(seq, usage, message, appname): if print_help_for_seq.allow_pager and sys.stdout.isatty(): import subprocess p = subprocess.Popen(['less', '-isRXF'], stdin=subprocess.PIPE) - p.communicate(text.encode('utf-8')) + try: + p.communicate(text.encode('utf-8')) + except KeyboardInterrupt: + raise SystemExit(1) raise SystemExit(p.wait()) else: print(text)