diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-03-23 11:30:38 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-03-23 11:30:54 -0400 |
commit | 3a4893ec32c6d38cad344667fead93e2eed8dc88 (patch) | |
tree | 65d6073d92769ff3f4e3fe023d47cafad6bacf73 /cmd2/cmd2.py | |
parent | fabe4cd01b339d628ffd0b8d9b202a4a41555b8b (diff) | |
download | cmd2-git-3a4893ec32c6d38cad344667fead93e2eed8dc88.tar.gz |
onecmd_plus_hooks() now sets self.exit_code when a SystemExit handled
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index f7188cb4..3430ad44 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2362,7 +2362,8 @@ class Cmd(cmd.Cmd): except KeyboardInterrupt as ex: if raise_keyboard_interrupt and not stop: raise ex - except SystemExit: + except SystemExit as ex: + self.exit_code = ex.code stop = True except PassThroughException as ex: raise ex.wrapped_ex @@ -2374,7 +2375,8 @@ class Cmd(cmd.Cmd): except KeyboardInterrupt as ex: if raise_keyboard_interrupt and not stop: raise ex - except SystemExit: + except SystemExit as ex: + self.exit_code = ex.code stop = True except PassThroughException as ex: raise ex.wrapped_ex |