From 3fc7b737f59b1c81a582f9006e5610bdc41d0ebe Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 29 Apr 2018 15:35:38 -0700 Subject: [PATCH] [Fix] `install -s`: `zsh`: ensure `shwordsplit` opt is set Fixes #1719. --- nvm.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nvm.sh b/nvm.sh index a211bb2..549a4f3 100644 --- a/nvm.sh +++ b/nvm.sh @@ -2047,6 +2047,13 @@ nvm_install_source() { local TMPDIR local VERSION_PATH + local ZSH_HAS_SHWORDSPLIT_UNSET + ZSH_HAS_SHWORDSPLIT_UNSET=1 + if nvm_has "setopt"; then + ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)" + setopt shwordsplit + fi + TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \ [ -f "${TARBALL}" ] && \ TMPDIR="$(dirname "${TARBALL}")/files" && \ @@ -2062,10 +2069,16 @@ nvm_install_source() { command rm -f "${VERSION_PATH}" 2>/dev/null && \ $make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install ); then + if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then + unsetopt shwordsplit + fi nvm_err "nvm: install ${VERSION} failed!" command rm -rf "${TMPDIR-}" return 1 fi + if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then + unsetopt shwordsplit + fi } nvm_use_if_needed() {