[Fix] remove `nvm_supports_source_options`

Fixes #2387
Jordan Harband 2021-01-07 13:00:26 -08:00
parent 9849bf494d
commit 436cda247e
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
2 changed files with 8 additions and 45 deletions

12
nvm.sh
View File

@ -3931,7 +3931,7 @@ nvm() {
nvm_has_system_node nvm_has_system_iojs \
nvm_download nvm_get_latest nvm_has nvm_install_default_packages nvm_get_default_packages \
nvm_curl_use_compression nvm_curl_version \
nvm_supports_source_options nvm_auto nvm_supports_xz \
nvm_auto nvm_supports_xz \
nvm_echo nvm_err nvm_grep nvm_cd \
nvm_die_on_prefix nvm_get_make_jobs nvm_get_minor_version \
nvm_has_solaris_binary nvm_is_merged_node_version \
@ -4013,14 +4013,6 @@ nvm_install_default_packages() {
fi
}
nvm_supports_source_options() {
# shellcheck disable=SC1091,SC2240
[ "_$( . /dev/stdin yes 2> /dev/null <<'EOF'
[ $# -gt 0 ] && nvm_echo $1
EOF
)" = "_yes" ]
}
nvm_supports_xz() {
if [ -z "${1-}" ]; then
return 1
@ -4108,7 +4100,6 @@ nvm_auto() {
nvm_process_parameters() {
local NVM_AUTO_MODE
NVM_AUTO_MODE='use'
if nvm_supports_source_options; then
while [ $# -ne 0 ]; do
case "$1" in
--install) NVM_AUTO_MODE='install' ;;
@ -4116,7 +4107,6 @@ nvm_process_parameters() {
esac
shift
done
fi
nvm_auto "${NVM_AUTO_MODE}"
}

View File

@ -1,27 +0,0 @@
#!/bin/sh
die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh
x=0
i=0
runs=5
calls=500
first_result=false
if (nvm_supports_source_options && printf .); then
first_result=true
fi
while [ $x -le $runs ]; do
y=$x
x=$(( x + 1 ))
while [ $i -le $calls ]; do
this_result=false
if (nvm_supports_source_options && printf .); then
this_result=true
fi
[ $this_result = $first_result ] || die "call ${i}, run ${y} got ${this_result}; expected ${first_result}"
i=$(( i + 1 ))
done
done
echo "${runs} runs of ${calls} calls succeeded"