[Fix] `set -a`: when this option is set, some `sh` shells break

Fixes #2574
Jordan Harband 2021-09-14 23:26:31 -07:00
parent d91087c333
commit b6b6e685a3
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 7 additions and 0 deletions

7
nvm.sh
View File

@ -2661,6 +2661,13 @@ nvm() {
EXIT_CODE="$?"
set -e
return "$EXIT_CODE"
elif [ "${-#*a}" != "$-" ]; then
set +a
local EXIT_CODE
IFS="${DEFAULT_IFS}" nvm "$@"
EXIT_CODE="$?"
set -a
return "$EXIT_CODE"
elif [ "${IFS}" != "${DEFAULT_IFS}" ]; then
IFS="${DEFAULT_IFS}" nvm "$@"
return "$?"