mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-02-06 01:42:49 +08:00
[Fix] nvm_has_colors: also check if stdout is a terminal
This commit is contained in:
@@ -33,6 +33,8 @@ printf '%s\n' "$(cat "${LTS_NAMES_PATH}" | tail -n +1)" | while IFS= read -r LTS
|
||||
cp "${NVM_DIR}/alias/lts-backup/${LTS}" "${NVM_DIR}/alias/lts/"
|
||||
done
|
||||
|
||||
nvm_has_colors() { return 0; }
|
||||
|
||||
nvm deactivate 2>/dev/null || die 'unable to deactivate'
|
||||
|
||||
\. ../../common.sh
|
||||
@@ -67,12 +69,14 @@ printf '%s\n' "${LTS_LIST}" | while IFS= read -r LTS; do
|
||||
INDEX=$(($INDEX + 1))
|
||||
done
|
||||
|
||||
nvm_has_colors() { return 1; }
|
||||
OUTPUT="$(nvm ls-remote lts/ARGON 2>&1)"
|
||||
EXIT_CODE=$?
|
||||
nvm_has_colors() { return 0; }
|
||||
[ $EXIT_CODE -eq 3 ] || die "nvm ls-remote lts/ARGON did not exit 3, got '${EXIT_CODE}'"
|
||||
|
||||
EXPECTED_OUTPUT="LTS names must be lowercase
|
||||
N/A"
|
||||
N/A *"
|
||||
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] || die "nvm ls-remote lts/ARGON did not output expected error message; got >${OUTPUT}< expected >${EXPECTED_OUTPUT}<"
|
||||
|
||||
REMOTE="${PWD}/mocks/nvm_ls_remote.txt"
|
||||
|
||||
Reference in New Issue
Block a user