From 9b957a1fdb52e8e1867c865527d96441d3422c65 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 22 Oct 2021 05:12:12 +0530 Subject: [PATCH] handle shlex exceptions gracefully --- kitty/shell.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kitty/shell.py b/kitty/shell.py index 35bf8c58e..d74a6e12d 100644 --- a/kitty/shell.py +++ b/kitty/shell.py @@ -187,7 +187,12 @@ def real_main(global_opts: RCOptions) -> None: print(end=set_cursor_shape(), flush=True) if not scmdline: continue - cmdline = shlex.split(scmdline) + try: + cmdline = shlex.split(scmdline) + except Exception: + print_err(f'"{emph(scmdline)}" is invalid. Use "help" to see a list of commands.') + continue + cmd = cmdline[0].lower() try: