Browse Source

[Fix] remove `nvm_supports_source_options`

Fixes #2387
Jordan Harband 4 years ago
parent
commit
436cda247e
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
  1. 26
      nvm.sh
  2. 27
      test/fast/Unit tests/nvm_supports_source_options

26
nvm.sh

@ -3931,7 +3931,7 @@ nvm() { @@ -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() { @@ -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,15 +4100,13 @@ nvm_auto() { @@ -4108,15 +4100,13 @@ 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' ;;
--no-use) NVM_AUTO_MODE='none' ;;
esac
shift
done
fi
while [ $# -ne 0 ]; do
case "$1" in
--install) NVM_AUTO_MODE='install' ;;
--no-use) NVM_AUTO_MODE='none' ;;
esac
shift
done
nvm_auto "${NVM_AUTO_MODE}"
}

27
test/fast/Unit tests/nvm_supports_source_options

@ -1,27 +0,0 @@ @@ -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"
Loading…
Cancel
Save