From d09b84de3ca1ce7c3551430c248c8140c3a0541c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 2 Nov 2014 13:54:54 -0800 Subject: [PATCH] Ensure that a system has `manpath` before invoking it. Closes #531, fixes #557. --- nvm.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nvm.sh b/nvm.sh index de5a5af..a388eab 100644 --- a/nvm.sh +++ b/nvm.sh @@ -836,20 +836,22 @@ nvm() { PATH=`nvm_strip_path "$PATH" "/bin"` # Prepend current version PATH=`nvm_prepend_path "$PATH" "$NVM_VERSION_DIR/bin"` - if [ -z "$MANPATH" ]; then - MANPATH=$(manpath) + if nvm_has manpath; then + if [ -z "$MANPATH" ]; then + MANPATH=$(manpath) + fi + # Strip other version from MANPATH + MANPATH=`nvm_strip_path "$MANPATH" "/share/man"` + # Prepend current version + MANPATH=`nvm_prepend_path "$MANPATH" "$NVM_VERSION_DIR/share/man"` + export MANPATH fi - # Strip other version from MANPATH - MANPATH=`nvm_strip_path "$MANPATH" "/share/man"` - # Prepend current version - MANPATH=`nvm_prepend_path "$MANPATH" "$NVM_VERSION_DIR/share/man"` # Strip other version from NODE_PATH NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"` # Prepend current version NODE_PATH=`nvm_prepend_path "$NODE_PATH" "$NVM_VERSION_DIR/lib/node_modules"` export PATH hash -r - export MANPATH export NODE_PATH export NVM_PATH="$NVM_VERSION_DIR/lib/node" export NVM_BIN="$NVM_VERSION_DIR/bin"