Skip to content

Commit abd02e5

Browse files
menaechmiljharb
authored andcommitted
[Fix] install.sh: fix failing install tests (nvm-sh#3458)
1 parent 3de0b15 commit abd02e5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ nvm_detect_profile() {
306306
if [ -z "$DETECTED_PROFILE" ]; then
307307
for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc"
308308
do
309-
if DETECTED_PROFILE="$(nvm_try_profile "${HOME}/${EACH_PROFILE}")"; then
309+
if DETECTED_PROFILE="$(nvm_try_profile "${ZDOTDIR:-${HOME}}/${EACH_PROFILE}")"; then
310310
break
311311
fi
312312
done

test/install_script/nvm_detect_profile

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cleanup () {
2323
unset -f setup cleanup die
2424
unset ZDOTDIR
2525
rm -f ".bashrc" ".bash_profile" ".zprofile" ".zshrc" ".profile" "test_profile" > "/dev/null" 2>&1
26-
rm -rf zdot>&1
26+
rm -rf zdotdir 2>&1
2727
}
2828

2929
die () { echo "$@" '$NVM_DETECT_PROFILE:' "$NVM_DETECT_PROFILE"; cleanup; exit 1; }
@@ -94,21 +94,21 @@ fi
9494
#
9595

9696
# It should favor .profile if file exists
97-
NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)"
97+
NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)"
9898
if [ "$NVM_DETECT_PROFILE" != "$HOME/.profile" ]; then
9999
die "nvm_detect_profile should have selected .profile"
100100
fi
101101

102102
# Otherwise, it should favor .bashrc if file exists
103103
rm ".profile"
104-
NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)"
104+
NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)"
105105
if [ "$NVM_DETECT_PROFILE" != "$HOME/.bashrc" ]; then
106106
die "nvm_detect_profile should have selected .bashrc"
107107
fi
108108

109109
# Otherwise, it should favor .bash_profile if file exists
110110
rm ".bashrc"
111-
NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)"
111+
NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)"
112112
if [ "$NVM_DETECT_PROFILE" != "$HOME/.bash_profile" ]; then
113113
die "nvm_detect_profile should have selected .bash_profile"
114114
fi

0 commit comments

Comments
 (0)