Make sure sourcing `nvm.sh` on shells that don't support source options doesn't exit nonzero.
Fixes #721master
parent
96c96ec714
commit
472ba5fc46
2
nvm.sh
2
nvm.sh
|
@ -1784,7 +1784,7 @@ nvm_supports_source_options() {
|
||||||
[ "_$(echo 'echo $1' | . /dev/stdin yes 2> /dev/null)" = "_yes" ]
|
[ "_$(echo 'echo $1' | . /dev/stdin yes 2> /dev/null)" = "_yes" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION="$(nvm_alias default 2>/dev/null)"
|
VERSION="$(nvm_alias default 2>/dev/null || echo)"
|
||||||
if nvm_supports_source_options && [ "_$1" = "_--install" ]; then
|
if nvm_supports_source_options && [ "_$1" = "_--install" ]; then
|
||||||
if [ -n "$VERSION" ]; then
|
if [ -n "$VERSION" ]; then
|
||||||
nvm install "$VERSION" >/dev/null
|
nvm install "$VERSION" >/dev/null
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
|
touch ../../alias/default
|
||||||
|
rm ../../alias/default || die 'removal of default alias failed'
|
||||||
|
nvm_alias default && die '"nvm_alias default" did not fail'
|
||||||
|
|
||||||
|
set -e # necessary to fail internally with a nonzero code
|
||||||
|
|
||||||
|
. ../../nvm.sh || die 'sourcing returned nonzero exit code'
|
Loading…
Reference in New Issue