@@ -2362,7 +2362,8 @@ def onecmd_plus_hooks(
23622362 except KeyboardInterrupt as ex :
23632363 if raise_keyboard_interrupt and not stop :
23642364 raise ex
2365- except SystemExit :
2365+ except SystemExit as ex :
2366+ self .exit_code = ex .code
23662367 stop = True
23672368 except PassThroughException as ex :
23682369 raise ex .wrapped_ex
@@ -2374,7 +2375,8 @@ def onecmd_plus_hooks(
23742375 except KeyboardInterrupt as ex :
23752376 if raise_keyboard_interrupt and not stop :
23762377 raise ex
2377- except SystemExit :
2378+ except SystemExit as ex :
2379+ self .exit_code = ex .code
23782380 stop = True
23792381 except PassThroughException as ex :
23802382 raise ex .wrapped_ex
@@ -4748,7 +4750,7 @@ class TestMyAppCase(Cmd2TestCase):
47484750 transcripts_expanded = utils .files_from_glob_patterns (transcript_paths , access = os .R_OK )
47494751 if not transcripts_expanded :
47504752 self .perror ('No test files found - nothing to test' )
4751- self .exit_code = - 1
4753+ self .exit_code = 1
47524754 return
47534755
47544756 verinfo = "." .join (map (str , sys .version_info [:3 ]))
@@ -4785,7 +4787,7 @@ class TestMyAppCase(Cmd2TestCase):
47854787 self .perror (error_str [start :])
47864788
47874789 # Return a failure error code to support automated transcript-based testing
4788- self .exit_code = - 1
4790+ self .exit_code = 1
47894791
47904792 def async_alert (self , alert_msg : str , new_prompt : Optional [str ] = None ) -> None : # pragma: no cover
47914793 """
0 commit comments