Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repozo: exit with non-zero code in case of verification failure #396

Merged
merged 2 commits into from
Feb 6, 2024

Conversation

perrinjerome
Copy link
Contributor

When verification failed, repozo prints a message on standard error, but the program always exits with a return code indicating a success. In case of error it's more natural to exit with an error return code.

@perrinjerome
Copy link
Contributor Author

This is a trivial change, the script is changed to raise a VerificationFail that is catched here and used to set the return code:

except (RepozoError, OSError) as e:
sys.exit(str(e))

quoting sys.exit doc https://docs.python.org/3.13/library/sys.html#sys.exit

any other object is printed to stderr and results in an exit code of 1. In particular, sys.exit("some error message") is a quick way to exit a program when an error occurs.

One visible change is that this only outputs the first error, but every errors are fatal so I was thinking it's not really important to have all error and this made the code a little simpler.

When verification failed, repozo prints a message on standard error,
but the program always exits with a return code indicating a success.
In case of error it's more natural to exit with an error return code.
@perrinjerome perrinjerome marked this pull request as ready for review February 1, 2024 14:41
@perrinjerome
Copy link
Contributor Author

Thank you @icemac

@perrinjerome perrinjerome merged commit d7f9eae into master Feb 6, 2024
24 checks passed
@perrinjerome perrinjerome deleted the repozo-verify-exit-code branch February 6, 2024 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants