[Fix] To confirm curl exists before detecting curl libz feature

Peter Dave Hello 2017-04-06 05:20:55 +08:00 committed by Jordan Harband
parent ec3ba1973a
commit daa9c3604d
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 4 additions and 4 deletions

4
nvm.sh
View File

@ -76,7 +76,7 @@ nvm_has_colors() {
}
nvm_curl_libz_support() {
curl -V | grep "^Features:" | grep -q "libz"
curl -V 2>/dev/null | nvm_grep "^Features:" | nvm_grep -q "libz"
}
nvm_get_latest() {
@ -102,10 +102,10 @@ nvm_get_latest() {
nvm_download() {
local CURL_COMPRESSED_FLAG
if nvm_has "curl"; then
if nvm_curl_libz_support; then
CURL_COMPRESSED_FLAG="--compressed"
fi
if nvm_has "curl"; then
curl "${CURL_COMPRESSED_FLAG:-}" -q "$@"
elif nvm_has "wget"; then
# Emulate curl with wget