From 96e8dab652eb7c0a30d1fb133acb5f21d4bfc50c Mon Sep 17 00:00:00 2001 From: cyberrumor Date: Mon, 11 Mar 2024 18:09:56 -0700 Subject: [PATCH] Exit clean from KeyboardInterrupt also --- ammo/ui.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ammo/ui.py b/ammo/ui.py index f7f1e7b..f0f941e 100755 --- a/ammo/ui.py +++ b/ammo/ui.py @@ -259,7 +259,7 @@ def help(self): print(out) try: input("[Enter] ") - except EOFError: + except (KeyboardInterrupt, EOFError): print() sys.exit(0) @@ -322,10 +322,10 @@ def repl(self): try: if not (stdin := input(f"{self.controller._prompt()}")): continue - except EOFError: + except (KeyboardInterrupt, EOFError): print() sys.exit(0) - + cmds = stdin.split() args = [] if len(cmds) <= 1 else cmds[1:] func = cmds[0] @@ -387,4 +387,4 @@ def repl(self): except Warning as warning: print(f"\n{warning}") - input("[Enter] ") + input("[Enter] ")