-
Notifications
You must be signed in to change notification settings - Fork 14
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
Ensure that scripts don't swallow errors either #26
base: main
Are you sure you want to change the base?
Ensure that scripts don't swallow errors either #26
Conversation
84ef5af
to
bf99b61
Compare
As I was attempting to do the same thing for |
An initial compromise step might be to accept this PR without the changes to Update: the latest commit reverts the changes to |
Its structure sort of depended on continuing in the face of errors, even though the way it works is buggy. That needs to be resolved by @SomeRandomiOSDev.
comparison=$("$(dirname "$0")/versions.sh" "$VERSION" "0.37.0"; echo $?) | ||
|
||
if [ $? -ge 0 ]; then | ||
if [ "$comparison" -ge 0 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be necessary to do things in this way given how the versions.sh
script exits, at least in theory. Are you not seeing this in your testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could state your reasoning?
Here's mine: this script is using -e -o pipefail
so it will exit with an error when any command it issues has a nonzero status, and versions.sh
“returns” -1, 0, or 1 in its status code. If it exits with code -1, -e
will cause this script to interpret it as a failure and exit immediately instead of continuing with the else
clause... right? And your intention was that the else
clause be reachable if versions.sh
returns -1, right?
@dabrahams Good callouts. I hesitate to re-write these scripts in Swift just given how much of a pain it is to invoke terminal commands from Swift. As you pointed out, however, the error model for bash scripts is pretty terrible, so I guess it's a matter of picking a poison. I'll take a deeper look at these scripts overall but for the time being I'd like to keep them as is |
The principled alternative is to use @SomeRandomiOSDev how does that approach sound to you? |
No description provided.