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

Use exit code 1 on failure when pulling #1047

Merged

Conversation

fmauch
Copy link
Contributor

@fmauch fmauch commented May 21, 2024

Currently, the pull command returns 0 even when a failure occurred.

My usecase is having this running in a systemd timer job and every now and then it happens, that I shutdown my machine while there is a pull command running. This results in a lockfile being present which prevent future runs from succeeding.

However, since that case is caught in an exception there is the error output, but the job itself returns success (exit code 0).

This PR exits with code 1 as done in _try_load_config, as this was the simplest to implement. Maybe a nicer approach would be to raise a SystemExit instead but that will not directly put it to the critical log. Please let me know what you would prefer.

Copy link
Collaborator

@ryneeverett ryneeverett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the code base, we seem to be evenly split between log.critical/sys.exit and SystemExit. I'm not aware if there's a substantive difference so I don't have a preference.

@fmauch
Copy link
Contributor Author

fmauch commented May 22, 2024

Perfect, then let's just leave it like that. Thanks for the quick review!

@ryneeverett ryneeverett merged commit 86c53e8 into GothenburgBitFactory:develop Jun 7, 2024
36 checks passed
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.

2 participants