mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-26 04:10:36 +08:00
[Fix] set -E: Add test for node install on Bash with an ERR trap and set -E
This commit is contained in:
committed by
Jordan Harband
parent
fb4538b360
commit
81f0f3ec19
9
nvm.sh
9
nvm.sh
@@ -2742,6 +2742,15 @@ nvm() {
|
||||
EXIT_CODE="$?"
|
||||
set -a
|
||||
return "$EXIT_CODE"
|
||||
elif [ -n "${BASH-}" ] && [ "${-#*E}" != "$-" ]; then
|
||||
# shellcheck disable=SC3041
|
||||
set +E
|
||||
local EXIT_CODE
|
||||
IFS="${DEFAULT_IFS}" nvm "$@"
|
||||
EXIT_CODE="$?"
|
||||
# shellcheck disable=SC3041
|
||||
set -E
|
||||
return "$EXIT_CODE"
|
||||
elif [ "${IFS}" != "${DEFAULT_IFS}" ]; then
|
||||
IFS="${DEFAULT_IFS}" nvm "$@"
|
||||
return "$?"
|
||||
|
||||
Reference in New Issue
Block a user