diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-03-26 14:40:34 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-03-26 14:40:34 -0400 |
commit | 1ed207686d2a5e4759501012e6ddc89d9d09e7d4 (patch) | |
tree | d46c4a29b067833697907718920bf5af12270761 /cmd2/cmd2.py | |
parent | cb0726ea693aadf5bc921ccb9eee35dc5823e17b (diff) | |
download | cmd2-git-1ed207686d2a5e4759501012e6ddc89d9d09e7d4.tar.gz |
Since runcode() catches most KeyboardInterrupts, just ignore any that make their way up to our code.
This is more consistent than raising the rare few that we see.
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 84a1ce67..1c733843 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1685,9 +1685,9 @@ class Cmd(cmd.Cmd): if py_bridge_call: # Stop saving command's stdout before command finalization hooks run self.stdout.pause_storage = True - except KeyboardInterrupt as e: + except KeyboardInterrupt as ex: if raise_keyboard_interrupt: - raise e + raise ex except (Cmd2ArgparseError, EmptyStatement): # Don't do anything, but do allow command finalization hooks to run pass @@ -3255,10 +3255,8 @@ class Cmd(cmd.Cmd): # noinspection PyBroadException try: interp.runcode(py_code_to_run) - except KeyboardInterrupt as e: - raise e except BaseException: - # We don't care about any other exceptions that happened in the Python code + # We don't care about any exceptions that happened in the Python code pass # Otherwise we will open an interactive Python shell |