[Fix] curl should fail if something wrong, fix #1556

Peter Dave Hello 2017-06-14 10:35:06 +08:00
parent cbdd41eee2
commit 11370fe823
1 changed files with 2 additions and 1 deletions

3
nvm.sh
View File

@ -110,11 +110,12 @@ nvm_download() {
if nvm_curl_use_compression; then if nvm_curl_use_compression; then
CURL_COMPRESSED_FLAG="--compressed" CURL_COMPRESSED_FLAG="--compressed"
fi fi
curl "${CURL_COMPRESSED_FLAG:-}" -q "$@" curl --fail "${CURL_COMPRESSED_FLAG:-}" -q "$@"
elif nvm_has "wget"; then elif nvm_has "wget"; then
# Emulate curl with wget # Emulate curl with wget
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \ ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
-e 's/--compressed //' \ -e 's/--compressed //' \
-e 's/--fail //' \
-e 's/-L //' \ -e 's/-L //' \
-e 's/-I /--server-response /' \ -e 's/-I /--server-response /' \
-e 's/-s /-q /' \ -e 's/-s /-q /' \