handle shlex exceptions gracefully

This commit is contained in:
Kovid Goyal 2021-10-22 05:12:12 +05:30
parent e18b0cd4c8
commit 9b957a1fdb
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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: