[Fix] ensure if `npm link` fails, that `$IFS` is not improperly set.

https://github.com/creationix/nvm/issues/1519#issuecomment-297850323
Jordan Harband 2017-04-28 00:39:48 -07:00
parent caa7de37af
commit accd6ae298
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 9 additions and 8 deletions

3
nvm.sh
View File

@ -3157,6 +3157,7 @@ nvm() {
nvm_echo "$INSTALLS" | command xargs npm install -g --quiet nvm_echo "$INSTALLS" | command xargs npm install -g --quiet
nvm_echo "Linking global packages from $VERSION..." nvm_echo "Linking global packages from $VERSION..."
(
set -f; IFS=' set -f; IFS='
' # necessary to turn off variable expansion except for newlines ' # necessary to turn off variable expansion except for newlines
for LINK in $LINKS; do for LINK in $LINKS; do
@ -3165,7 +3166,7 @@ nvm() {
(nvm_cd "$LINK" && npm link) (nvm_cd "$LINK" && npm link)
fi fi
done done
set +f; unset IFS # restore variable expansion in case $LINKS was empty )
;; ;;
"clear-cache" ) "clear-cache" )
command rm -f "$NVM_DIR/v*" "$(nvm_version_dir)" 2>/dev/null command rm -f "$NVM_DIR/v*" "$(nvm_version_dir)" 2>/dev/null