From 2eccc81fee87ad94dbf29432062e129afb1d1d17 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 10 Mar 2021 14:04:40 +0530 Subject: [PATCH] Show a message about how to exit --hold --- __main__.py | 8 +++++++- kitty/cli.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/__main__.py b/__main__.py index 83c7311f7..3c4a5051b 100644 --- a/__main__.py +++ b/__main__.py @@ -30,8 +30,14 @@ def runpy(args: List[str]) -> None: def hold(args: List[str]) -> None: import subprocess + from contextlib import suppress + import tty ret = subprocess.Popen(args[1:]).wait() - sys.stdin.read() + with suppress(BaseException): + print('\n\x1b[1;32mPress any key to exit', end='', flush=True) + with suppress(BaseException): + tty.setraw(sys.stdin.fileno()) + sys.stdin.buffer.read(1) raise SystemExit(ret) diff --git a/kitty/cli.py b/kitty/cli.py index 50d3dfd1c..11c672354 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -611,7 +611,7 @@ created after startup. --hold type=bool-set Remain open after child process exits. Note that this only affects the first -window. You can quit by either using the close window shortcut or :kbd:`Ctrl+d`. +window. You can quit by either using the close window shortcut or pressing any key. --single-instance -1