Skip to content
Myr

Merge pull request #597 from danielb2/which

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix `nvm which` to use conventional direct path to program, like system `which`

authored by Jordan Harband · committed by Jordan Harband · parents b3178ca, 99ca0de · Browse files · 2 files+5 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−4 removed

  • tests:+3 added−2 removed
  • other:+2 added−2 removed

2 files+5 added−4 removed

modified:test/fast/Listing paths/Running "nvm which 0.0.2" should display only version 0.0.2.+3 added-2 removed
7 unmodified lines
8die () { echo $@ ; exit 1; }910# The result should contain only the appropriate version numbers.1112nvm which 0.0.212nvm which 0.0.2 | grep "$NVM_DIR/v0.0.2/bin" > /dev/null13nvm which 0.0.2 | grep "$NVM_DIR/v0.0.2/bin/node" > /dev/null14if [ $? -ne 0 ]; then15 die '"nvm which 0.0.2" did not contain the correct path'16fi1717nvm which 0.0.20 | grep "$NVM_DIR/v0.0.20/bin" > /dev/null18nvm which 0.0.20 | grep "$NVM_DIR/v0.0.20/bin/node" > /dev/null19if [ $? -ne 0 ]; then20 die '"nvm which 0.0.2" did not contain the correct path'21fi
modified:nvm.sh+2 added-2 removed
963 unmodified lines
964 fi965966 if [ "_$VERSION" = '_system' ]; then967 if nvm_has_system_node >/dev/null 2>&1; then968 echo $(nvm use system && echo dirname $(which node))968 echo $(nvm use system > /dev/null 2>&1 && echo $(which node))969 return970 else971 echo "System version of node not found." >&2972 return 127
8 unmodified lines
981 if [ ! -d "$NVM_VERSION_DIR" ]; then982 echo "$VERSION version is not installed yet" >&2983 return 1984 fi985 echo $NVM_DIR/$VERSION/bin985 echo $NVM_DIR/$VERSION/bin/node986 ;;987 "alias" )988 mkdir -p "$NVM_DIR/alias"989 if [ $# -le 2 ]; then
106 unmodified lines