mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
[Fix] nvm-exec
: properly exit when failing; improve error messages, suppress nvm use --help
output
Fixes #997.
This commit is contained in:
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
|
||||
|
||||
if [ -n "$NODE_VERSION" ]; then
|
||||
nvm use $NODE_VERSION > /dev/null || (echo "NODE_VERSION not set" >&2 && exit 127)
|
||||
else
|
||||
nvm use > /dev/null || (echo "No .nvmrc file found" >&2 && exit 127)
|
||||
nvm use $NODE_VERSION > /dev/null || exit 127
|
||||
elif ! nvm use >/dev/null 2>&1; then
|
||||
echo "No NODE_VERSION provided; no .nvmrc file found" >&2
|
||||
exit 127
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user