[Fix] nvm_has_colors: also check if stdout is a terminal

This commit is contained in:
Jordan Harband
2026-01-26 23:31:00 -08:00
parent d2f93c1c8e
commit 35212c1346
17 changed files with 94 additions and 39 deletions

2
nvm.sh
View File

@@ -83,7 +83,7 @@ nvm_has_colors() {
if nvm_has tput; then
NVM_NUM_COLORS="$(command tput -T "${TERM:-vt100}" colors)"
fi
[ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
[ -t 1 ] && [ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
}
nvm_curl_libz_support() {