Improve exit code implementation
Unnecessary dynamic GitReviewException.EXIT_CODE attribute lookup refactored into static to benefit static analyzers. Default process exit code changed from 127 (command not found error) to 1 (general error) Change-Id: I1fcb583a740bf32c4427a587e208d099712a7bc4
This commit is contained in:
parent
af955c932e
commit
d94e3a3431
@ -75,7 +75,7 @@ class colors(object):
|
||||
|
||||
|
||||
class GitReviewException(Exception):
|
||||
EXIT_CODE = 127
|
||||
EXIT_CODE = 1
|
||||
|
||||
|
||||
class CommandFailed(GitReviewException):
|
||||
@ -1704,7 +1704,7 @@ def main():
|
||||
_main()
|
||||
except GitReviewException as e:
|
||||
print(e)
|
||||
sys.exit(getattr(e, 'EXIT_CODE', -1))
|
||||
sys.exit(e.EXIT_CODE)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
6
releasenotes/notes/fix-exit-code-5ab7f6314976319f.yaml
Normal file
6
releasenotes/notes/fix-exit-code-5ab7f6314976319f.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes ``gitreview`` process exit code to align with general
|
||||
UNIX process exit code conventions. Specifically, default exit
|
||||
code changed to ``1`` which stands for "general error".
|
Loading…
Reference in New Issue
Block a user