Now returns -1 when an uncaught exception is found.

This commit is contained in:
Joe Testa 2020-07-07 16:31:44 -04:00
parent 49bd2c96a8
commit f80e3f22ce

View File

@ -51,6 +51,7 @@ PROGRAM_RETVAL_FAILURE = 3
PROGRAM_RETVAL_WARNING = 2 PROGRAM_RETVAL_WARNING = 2
PROGRAM_RETVAL_CONNECTION_ERROR = 1 PROGRAM_RETVAL_CONNECTION_ERROR = 1
PROGRAM_RETVAL_GOOD = 0 PROGRAM_RETVAL_GOOD = 0
PROGRAM_RETVAL_UNKNOWN_ERROR = -1
try: # pragma: nocover try: # pragma: nocover
from colorama import init as colorama_init from colorama import init as colorama_init
@ -3516,5 +3517,12 @@ def main() -> int:
if __name__ == '__main__': # pragma: nocover if __name__ == '__main__': # pragma: nocover
exit_code = PROGRAM_RETVAL_GOOD
try:
exit_code = main() exit_code = main()
except Exception:
exit_code = PROGRAM_RETVAL_UNKNOWN_ERROR
print(traceback.format_exc())
sys.exit(exit_code) sys.exit(exit_code)