mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Make sure to ignore ~/.curlrc if it exists.
				
					
				
			This commit is contained in:
		| @@ -42,7 +42,7 @@ nvm_source() { | |||||||
|  |  | ||||||
| nvm_download() { | nvm_download() { | ||||||
|   if nvm_has "curl"; then |   if nvm_has "curl"; then | ||||||
|     curl $* |     curl -q $* | ||||||
|   elif nvm_has "wget"; then |   elif nvm_has "wget"; then | ||||||
|     # Emulate curl with wget |     # Emulate curl with wget | ||||||
|     ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \ |     ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \ | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -20,7 +20,7 @@ nvm_is_alias() { | |||||||
| nvm_get_latest() { | nvm_get_latest() { | ||||||
|   local NVM_LATEST_URL |   local NVM_LATEST_URL | ||||||
|   if nvm_has "curl"; then |   if nvm_has "curl"; then | ||||||
|     NVM_LATEST_URL="$(curl -w "%{url_effective}\n" -L -s -S http://latest.nvm.sh -o /dev/null)" |     NVM_LATEST_URL="$(curl -q -w "%{url_effective}\n" -L -s -S http://latest.nvm.sh -o /dev/null)" | ||||||
|   elif nvm_has "wget"; then |   elif nvm_has "wget"; then | ||||||
|     NVM_LATEST_URL="$(wget http://latest.nvm.sh --server-response -O /dev/null 2>&1 | awk '/^  Location: /{DEST=$2} END{ print DEST }')" |     NVM_LATEST_URL="$(wget http://latest.nvm.sh --server-response -O /dev/null 2>&1 | awk '/^  Location: /{DEST=$2} END{ print DEST }')" | ||||||
|   else |   else | ||||||
| @@ -37,7 +37,7 @@ nvm_get_latest() { | |||||||
|  |  | ||||||
| nvm_download() { | nvm_download() { | ||||||
|   if nvm_has "curl"; then |   if nvm_has "curl"; then | ||||||
|     curl $* |     curl -q $* | ||||||
|   elif nvm_has "wget"; then |   elif nvm_has "wget"; then | ||||||
|     # Emulate curl with wget |     # Emulate curl with wget | ||||||
|     ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \ |     ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \ | ||||||
|   | |||||||
| @@ -10,12 +10,12 @@ cleanup() { | |||||||
|  |  | ||||||
| EXPECTED_VERSION="v12.3.456" | EXPECTED_VERSION="v12.3.456" | ||||||
| URL="https://github.com/creationix/nvm/releases/tag/$EXPECTED_VERSION" | URL="https://github.com/creationix/nvm/releases/tag/$EXPECTED_VERSION" | ||||||
| EXPECTED_CURL_ARGS="-w %{url_effective}\n -L -s -S http://latest.nvm.sh -o /dev/null" | EXPECTED_CURL_ARGS="-q -w %{url_effective}\n -L -s -S http://latest.nvm.sh -o /dev/null" | ||||||
| EXPECTED_WGET_ARGS="http://latest.nvm.sh --server-response -O /dev/null" | EXPECTED_WGET_ARGS="http://latest.nvm.sh --server-response -O /dev/null" | ||||||
|  |  | ||||||
| curl() { | curl() { | ||||||
|   if [ "_$*" != "_$EXPECTED_CURL_ARGS" ]; then |   if [ "_$*" != "_$EXPECTED_CURL_ARGS" ]; then | ||||||
|     echo 2>& "expected args ($EXPECTED_CURL_ARGS), got ($*)" |     echo >&2 "expected args ($EXPECTED_CURL_ARGS), got ($*)" | ||||||
|     return 1 |     return 1 | ||||||
|   else |   else | ||||||
|     echo $URL |     echo $URL | ||||||
| @@ -23,7 +23,7 @@ curl() { | |||||||
| } | } | ||||||
| wget() { | wget() { | ||||||
|   if [ "_$*" != "_$EXPECTED_WGET_ARGS" ]; then |   if [ "_$*" != "_$EXPECTED_WGET_ARGS" ]; then | ||||||
|     echo 2>& "expected args ($EXPECTED_WGET_ARGS), got ($*)" |     echo >&2 "expected args ($EXPECTED_WGET_ARGS), got ($*)" | ||||||
|     return 1 |     return 1 | ||||||
|   else |   else | ||||||
|     local WGET_CONTENTS |     local WGET_CONTENTS | ||||||
| @@ -100,7 +100,7 @@ Saving to: ‘/dev/null’ | |||||||
| " | " | ||||||
|     "$WGET_CONTENTS" | while read line |     "$WGET_CONTENTS" | while read line | ||||||
|     do |     do | ||||||
|       2>& echo "$line" |       >&2 echo "$line" | ||||||
|     done |     done | ||||||
|   fi |   fi | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user