`nvm debug`: Improve OS version detection
parent
8ff437ae51
commit
ca66a13710
12
nvm.sh
12
nvm.sh
|
@ -2383,6 +2383,7 @@ nvm() {
|
|||
|
||||
"debug" )
|
||||
local ZSH_HAS_SHWORDSPLIT_UNSET
|
||||
local OS_VERSION
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
|
@ -2405,9 +2406,16 @@ nvm() {
|
|||
nvm_err "shell version: '$(${SHELL} --version | command head -n 1)'"
|
||||
nvm_err "uname -a: '$(command uname -a | command awk '{$2=""; print}' | command xargs)'"
|
||||
if [ "$(nvm_get_os)" = "darwin" ] && nvm_has sw_vers; then
|
||||
nvm_err "OS version: $(sw_vers | command awk '{print $2}' | command xargs)"
|
||||
OS_VERSION="$(sw_vers | command awk '{print $2}' | command xargs)"
|
||||
elif [ -r "/etc/issue" ]; then
|
||||
nvm_err "OS version: $(command head -n 1 /etc/issue | command sed 's/\\.//g')"
|
||||
OS_VERSION="$(command head -n 1 /etc/issue | command sed 's/\\.//g')"
|
||||
if [ -z "${OS_VERSION}" ] && [ -r "/etc/os-release" ] ; then
|
||||
# shellcheck disable=SC1091
|
||||
OS_VERSION="$(. /etc/os-release && echo "${NAME}" "${VERSION}")"
|
||||
fi
|
||||
fi
|
||||
if [ -n "${OS_VERSION}" ]; then
|
||||
nvm_err "OS version: ${OS_VERSION}"
|
||||
fi
|
||||
if nvm_has "curl"; then
|
||||
nvm_err "curl: $(nvm_command_info curl), $(command curl -V | command head -n 1)"
|
||||
|
|
Loading…
Reference in New Issue