[Fix] `nvm-exec`: properly exit when failing; improve error messages, suppress `nvm use --help` output
Fixes #997.
parent
649e416017
commit
77e0449c89
7
nvm-exec
7
nvm-exec
|
@ -5,9 +5,10 @@ DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
. "$DIR/nvm.sh" --no-use
|
. "$DIR/nvm.sh" --no-use
|
||||||
|
|
||||||
if [ -n "$NODE_VERSION" ]; then
|
if [ -n "$NODE_VERSION" ]; then
|
||||||
nvm use $NODE_VERSION > /dev/null || (echo "NODE_VERSION not set" >&2 && exit 127)
|
nvm use $NODE_VERSION > /dev/null || exit 127
|
||||||
else
|
elif ! nvm use >/dev/null 2>&1; then
|
||||||
nvm use > /dev/null || (echo "No .nvmrc file found" >&2 && exit 127)
|
echo "No NODE_VERSION provided; no .nvmrc file found" >&2
|
||||||
|
exit 127
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
Loading…
Reference in New Issue