From abd02e5aae7984f472cd2bd47558d43029ef771c Mon Sep 17 00:00:00 2001 From: menaechmi Date: Tue, 12 Nov 2024 11:57:02 -0600 Subject: [PATCH] [Fix] `install.sh`: fix failing install tests (#3458) --- install.sh | 2 +- test/install_script/nvm_detect_profile | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index b2deb86..f8bafd4 100755 --- a/install.sh +++ b/install.sh @@ -306,7 +306,7 @@ nvm_detect_profile() { if [ -z "$DETECTED_PROFILE" ]; then for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc" do - if DETECTED_PROFILE="$(nvm_try_profile "${HOME}/${EACH_PROFILE}")"; then + if DETECTED_PROFILE="$(nvm_try_profile "${ZDOTDIR:-${HOME}}/${EACH_PROFILE}")"; then break fi done diff --git a/test/install_script/nvm_detect_profile b/test/install_script/nvm_detect_profile index 1434574..62b9d2f 100755 --- a/test/install_script/nvm_detect_profile +++ b/test/install_script/nvm_detect_profile @@ -23,7 +23,7 @@ cleanup () { unset -f setup cleanup die unset ZDOTDIR rm -f ".bashrc" ".bash_profile" ".zprofile" ".zshrc" ".profile" "test_profile" > "/dev/null" 2>&1 - rm -rf zdot>&1 + rm -rf zdotdir 2>&1 } die () { echo "$@" '$NVM_DETECT_PROFILE:' "$NVM_DETECT_PROFILE"; cleanup; exit 1; } @@ -94,21 +94,21 @@ fi # # It should favor .profile if file exists -NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)" +NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)" if [ "$NVM_DETECT_PROFILE" != "$HOME/.profile" ]; then die "nvm_detect_profile should have selected .profile" fi # Otherwise, it should favor .bashrc if file exists rm ".profile" -NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)" +NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)" if [ "$NVM_DETECT_PROFILE" != "$HOME/.bashrc" ]; then die "nvm_detect_profile should have selected .bashrc" fi # Otherwise, it should favor .bash_profile if file exists rm ".bashrc" -NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)" +NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)" if [ "$NVM_DETECT_PROFILE" != "$HOME/.bash_profile" ]; then die "nvm_detect_profile should have selected .bash_profile" fi