From be5e8de0c8bed35518612282e08f84e2d82e8ff5 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 2 Jul 2015 22:45:11 -0700 Subject: [PATCH] Fix `nvm reinstall-packages` for linked packages, broken in 7bce6c6c687420c54fd314157cff305b7adb98b5 --- nvm.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nvm.sh b/nvm.sh index cf9e73a..cc5f1bb 100755 --- a/nvm.sh +++ b/nvm.sh @@ -1765,14 +1765,18 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')" echo "$INSTALLS" | command xargs npm install -g --quiet local LINKS - LINKS="$(echo "$NPMLIST" | command sed -n 's/.* -> \(.*\)/\1/ p')" # | command sed -e '/^ *$/d;s/.*/"&"/') + LINKS="$(echo "$NPMLIST" | command sed -n 's/.* -> \(.*\)/\1/ p')" echo "Linking global packages from $VERSION..." - for LINK in "$LINKS"; do + set -f; IFS=' +' # necessary to turn off variable expansion except for newlines + for LINK in $LINKS; do + set +f; unset IFS # restore variable expansion if [ -n "$LINK" ]; then (cd "$LINK" && npm link) fi done + set +f; unset IFS # restore variable expansion in case $LINKS was empty ;; "clear-cache" ) command rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null