diff options
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 |