Make ExitStatus subclass IntEnum to allow direct int comparisons

This commit is contained in:
Jakub Roztocil 2019-09-18 11:57:06 +02:00
parent f031b8cc8b
commit d9b3a16fa6
2 changed files with 4 additions and 4 deletions

View File

@ -68,7 +68,7 @@ def main(
raise
exit_status = ExitStatus.ERROR_CTRL_C
except SystemExit as e:
if e.code != ExitStatus.SUCCESS.value:
if e.code != ExitStatus.SUCCESS:
env.stderr.write('\n')
if include_traceback:
raise
@ -86,7 +86,7 @@ def main(
raise
exit_status = ExitStatus.ERROR_CTRL_C
except SystemExit as e:
if e.code != ExitStatus.SUCCESS.value:
if e.code != ExitStatus.SUCCESS:
env.stderr.write('\n')
if include_traceback:
raise

View File

@ -1,7 +1,7 @@
from enum import Enum
from enum import IntEnum
class ExitStatus(Enum):
class ExitStatus(IntEnum):
"""Program exit code constants."""
SUCCESS = 0
ERROR = 1