Skip to content

Commit 2ec54e2

Browse files
[New] Supercharge nvm debug output
Try to get shell version, OS and its version, curl/wget version.
1 parent e41197e commit 2ec54e2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

nvm.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,6 +2249,35 @@ nvm() {
22492249
nvm_err "\$NPM_CONFIG_PREFIX: '$(nvm_sanitize_path "$NPM_CONFIG_PREFIX")'"
22502250
nvm_err "\$NVM_NODEJS_ORG_MIRROR: '${NVM_NODEJS_ORG_MIRROR}'"
22512251
nvm_err "\$NVM_IOJS_ORG_MIRROR: '${NVM_IOJS_ORG_MIRROR}'"
2252+
nvm_err "shell version: '$(${SHELL} --version | command head -n 1)'"
2253+
nvm_err "uname -a: '$(uname -a | awk '{$2=""; print}' | xargs)'"
2254+
if [ "$(nvm_get_os)" = "darwin" ] && nvm_has sw_vers; then
2255+
nvm_err "OS version: $(sw_vers | command awk '{print $2}' | command xargs)"
2256+
elif [ -r "/etc/issue" ]; then
2257+
nvm_err "OS version: $(command head -n 1 /etc/issue | command sed 's/\\.//g')"
2258+
fi
2259+
if nvm_has "curl"; then
2260+
local CURL
2261+
if type curl | command grep -q hashed; then
2262+
CURL="$(type curl | command sed -E 's/\(|)//g' | command awk '{print $4}')"
2263+
elif type curl | command grep -q aliased; then
2264+
CURL="$(type curl | command awk '{ $1=$2=$3=$4="" ;print }')"
2265+
else
2266+
CURL="$(type curl)"
2267+
fi
2268+
nvm_err "curl: ${CURL}, $(command curl -V | command head -n 1)"
2269+
fi
2270+
if nvm_has "wget"; then
2271+
local WGET
2272+
if type wget | command grep -q hashed; then
2273+
WGET="$(type wget | command sed -E 's/\(|)//g' | command awk '{print $4}')"
2274+
elif type wget | command grep -q aliased; then
2275+
WGET="$(type wget | command awk '{ $1=$2=$3=$4="" ;print }')"
2276+
else
2277+
WGET="$(type wget)"
2278+
fi
2279+
nvm_err "wget: ${WGET}, $(command wget -V | command head -n 1)"
2280+
fi
22522281
local NVM_DEBUG_OUTPUT
22532282
for NVM_DEBUG_COMMAND in 'nvm current' 'which node' 'which iojs' 'which npm' 'npm config get prefix' 'npm root -g'
22542283
do

0 commit comments

Comments
 (0)