Merge pull request #444 from creationix/fix_nvm_ls
Make sure `nvm ls foo` returns a nonzero exit code when a version is not foundmaster
commit
60fec40613
8
nvm.sh
8
nvm.sh
|
@ -571,11 +571,15 @@ nvm() {
|
||||||
NODE_PATH=$RUN_NODE_PATH $NVM_DIR/$VERSION/bin/node "$@"
|
NODE_PATH=$RUN_NODE_PATH $NVM_DIR/$VERSION/bin/node "$@"
|
||||||
;;
|
;;
|
||||||
"ls" | "list" )
|
"ls" | "list" )
|
||||||
nvm_print_versions "`nvm_ls $2`"
|
local NVM_LS_OUTPUT
|
||||||
|
local NVM_LS_EXIT_CODE
|
||||||
|
NVM_LS_OUTPUT=$(nvm_ls "$2")
|
||||||
|
NVM_LS_EXIT_CODE=$?
|
||||||
|
nvm_print_versions "$NVM_LS_OUTPUT"
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
nvm alias
|
nvm alias
|
||||||
fi
|
fi
|
||||||
return
|
return $NVM_LS_EXIT_CODE
|
||||||
;;
|
;;
|
||||||
"ls-remote" | "list-remote" )
|
"ls-remote" | "list-remote" )
|
||||||
nvm_print_versions "`nvm_ls_remote $2`"
|
nvm_print_versions "`nvm_ls_remote $2`"
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ../../nvm.sh
|
||||||
|
|
||||||
|
nvm ls nonexistent_version
|
||||||
|
[ "$?" = "3" ]
|
||||||
|
|
Loading…
Reference in New Issue