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

Check the exit code of a command, instead of relying on stderr #432

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

mauritsvanrees
Copy link
Member

When a command fails, always ask the user to continue or not. I hope with this we strike a good balance between showing error output, exit codes, and asking if the user wants to continue.

With the previous alpha release, the balance was not good for me. The final git push used stderr to report that everything was fine, and then postrelease treated this as an error, and asked me if I wanted to continue. Now we check the exit code.

@elisallenens @gforcada Since Reinout is unavailable for a while, can you review it, or simply try this branch out when releasing some packages? I could also do another alpha release to more easily try it.

… this in the output.

Note that this is tricky to do right.  Some commands like ``git`` seem to print everything to stderr,
leading us to think there are errors, but the exit code is zero, so it should be fine.
We do not want to ask the user to often if she wants to continue or not.
But we do not want to silently swallow important errors either.
Interestingly, this needed some fixes in the tests, where commands had gone wrong for years but we never noticed.

* At the end of `fullrelease` we try to push, and this always failed because there was no push target.
  We now ignore the push commands and instead print them.
* One test renames `CHANGES.rst` to `CHANGES.md`, and then calling `python setup.py --version` actually fails:
  `setup.py` still tries to read the no longer existing `CHANGES.rst`.

I hope we now strike a good balance between showing error output, exit codes, and asking if the user wants to continue.
With the previous alpha release, the balance was not good for me.  The final `git push` used `stderr` to report that everything was fine,
and then `postrelease` treated this as an error, and asked me if I wanted to continue.  Now we check the exit code.
@elisalle
Copy link
Contributor

elisalle commented Jul 31, 2023

I tried it out with some purposefully badly configured packages; it gives errors where it should and no errors where it shouldn't, so it seems fine to me.

@mauritsvanrees mauritsvanrees merged commit 41be659 into master Jul 31, 2023
6 checks passed
@mauritsvanrees mauritsvanrees deleted the maurits-check-exit-code branch July 31, 2023 20:34
@mauritsvanrees
Copy link
Member Author

Thanks for reviewing!
I have released 9.0.0b1.

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