Return the proper exit code of `which` directly.

master
Jordan Harband 2014-12-19 16:12:13 -08:00
parent 0ac2c787be
commit 9e17b5059c
1 changed files with 8 additions and 2 deletions

8
nvm.sh
View File

@ -965,8 +965,14 @@ nvm() {
if [ "_$VERSION" = '_system' ]; then if [ "_$VERSION" = '_system' ]; then
if nvm_has_system_node >/dev/null 2>&1; then if nvm_has_system_node >/dev/null 2>&1; then
echo $(nvm use system > /dev/null 2>&1 && echo $(which node)) local NVM_BIN
NVM_BIN="$(nvm use system >/dev/null 2>&1 && which node)"
if [ -n "$NVM_BIN" ]; then
echo "$NVM_BIN"
return return
else
return 1
fi
else else
echo "System version of node not found." >&2 echo "System version of node not found." >&2
return 127 return 127