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
Install script does not exit with non-zero status code on failure. #2439
Comments
Oh my this is not good IMO. I think this is a bug rather than an enhancement request. |
IMO, if we run |
The issue as described is that our exit pathway for no network access is failing to return the error code properly. It's possible to install rustup and then not have it on-path and for that to be deliberate so we can't just try to execvp |
Actually the install script does return a non-zero status code if it fails. > (echo "unset PATH"; curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs) | sh; echo $?
rustup: need 'curl or wget' (command not found)
1 The cause of OP's problem was, that he ran the command without a network connection, so Fixing this problem is actually quite simple. We can detect if (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs || echo exit 1) | sh So I am not sure if this still is an issue we need to fix, but if you do think so I'd be happy to replace all occurrences of the old command with this "fixed" one and submit a PR. |
Nicely caught. My gut feeling here is that there's no great value in changing the recommended command to be even more complex. People already whine from time to time about the extra arguments to curl, let alone if we introduced a subshell and so on. I'm going to close this and hope the issue stands as something people will find if they accidentally hit a similar situation. |
Describe the problem you are trying to solve
The install script invoked by this command
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
does not exit with non-zero status code on failure. It's hard to detect failure partial success or complete success at this point. This makes putting this command in another automation harder.Describe the solution you'd like
Install script exits with non-zero status code on any error.
Notes
I'm using the script in automated mode like this.
This always exits with
0
. I tested this with no network connection and script fails withcurl: (6) Could not resolve host: sh.rustup.rs
error but exit code is still0
.The text was updated successfully, but these errors were encountered: