-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Fix] Install failed should return correct exit status, fix #1347 #1348
Conversation
nvm.sh
Outdated
fi | ||
|
||
fi | ||
|
||
if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then | ||
if [ "$NVM_INSTALL_EXIT_STATUS" = 0 ] && nvm use "$VERSION"; 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.
This if
can make the exit status volatile so I try to save the exit status.
e82d91d
to
8f6862f
Compare
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.
Awesome! Just a few changes and this is good to go.
nvm.sh
Outdated
fi | ||
if [ "$NVM_INSTALL_SUCCESS" != true ]; then | ||
if [ "$NVM_INSTALL_EXIT_CODE" != 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.
this should use -ne 0
nvm.sh
Outdated
fi | ||
|
||
fi | ||
|
||
if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then | ||
if [ "$NVM_INSTALL_EXIT_CODE" = 0 ] && nvm use "$VERSION"; 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.
and -eq 0
nvm.sh
Outdated
fi | ||
fi | ||
return $? | ||
return "${NVM_INSTALL_EXIT_CODE}" |
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.
no need for the quotes or curlies here, it will error if it's not a number
The test failure looks legit, btw. |
hmmm ... didn't realize the reason it failed yet ... will update the updates I can do first |
8f6862f
to
f58f0a9
Compare
nvm.sh
Outdated
@@ -2425,7 +2425,7 @@ nvm() { | |||
nvm_err '*** Third-party $NVM_INSTALL_THIRD_PARTY_HOOK env var claimed to succeed, but failed to install! ***' | |||
return 33 | |||
fi | |||
NVM_INSTALL_SUCCESS=true | |||
NVM_INSTALL_EXIT_CODE=0 |
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.
i think this should set it to "${EXIT_CODE}"
since that's the exit code from the hook.
nvm.sh
Outdated
fi | ||
fi | ||
return $? | ||
return ${NVM_INSTALL_EXIT_CODE} |
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.
the braces here only work inside a string - so they should be removed.
f58f0a9
to
ef69042
Compare
Fixed! |
fi | ||
if [ "$NVM_INSTALL_SUCCESS" != true ]; then | ||
if [ "$EXIT_CODE" -ne 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.
if we're going to do this check, we should set it to -1
initially, or else set -u
might complain.
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.
ef69042
to
2878edb
Compare
nvm.sh
Outdated
@@ -2417,6 +2416,7 @@ nvm() { | |||
local VERSION_PATH | |||
VERSION_PATH="$(nvm_version_path "${VERSION}")" | |||
local EXIT_CODE |
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.
this line should be removed, or else the local
will be run twice, which creates shell output in zsh
nvm.sh
Outdated
@@ -2417,6 +2416,7 @@ nvm() { | |||
local VERSION_PATH | |||
VERSION_PATH="$(nvm_version_path "${VERSION}")" | |||
local EXIT_CODE | |||
EXIT_CODE=-1 |
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.
similarly, this should be initialized at the first definition of the var, after line 2408.
2878edb
to
8b5dc18
Compare
Hope this time we are good to go, thanks for your time @ljharb |
Looks like https://travis-ci.org/creationix/nvm/jobs/186911975 is still a legit test failure. |
The error message looks ... so unrelated ... lol ... still trying to find out the problem |
8b5dc18
to
055a6c2
Compare
Any update on this? Downstream it's still affecting travis builds -- over the last couple of days, there was another outage where node downloads were failing, but travis builds didn't stop, making triage more confusing. |
We didn't figure out the reason why test failed yet. |
@PeterDaveHello I'm wondering if Would you mind rebasing this to see if it's still failing? |
Okay, will need to fix the conflicts first. |
055a6c2
to
518f757
Compare
Rebased |
Still failed here, lol ... |
Note: I believe this does not fix the underlying issue in zsh, which is that it does not split up `$ADDITIONAL_PARAMETERS` and instead passes the contents as one single argument.
518f757
to
9b26293
Compare
@PeterDaveHello k, i think i fixed the issue for this PR - but I did not fix the underlying issue with zsh and If you can fix that, or if you have a better way than mine, please feel free to amend my commit. |
@ljharb I think it looks good enough for me right now. |
Fix #1347