Don’t restrict colors to TTYs.
This restriction prevents subcommands from producing colors and passing them up the tree to the actual TTY.
parent
0880539972
commit
eeaddf9ab0
2
nvm.sh
2
nvm.sh
|
@ -34,9 +34,7 @@ nvm_is_alias() {
|
||||||
|
|
||||||
nvm_has_colors() {
|
nvm_has_colors() {
|
||||||
local NVM_COLORS
|
local NVM_COLORS
|
||||||
if test -t 1; then
|
|
||||||
NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
|
NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
|
||||||
fi
|
|
||||||
[ "${NVM_COLORS:--1}" -ge 8 ]
|
[ "${NVM_COLORS:--1}" -ge 8 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ../../common.sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
@ -14,5 +16,5 @@ OUTPUT="$(nvm_ensure_default_set 0.2)"
|
||||||
EXPECTED_OUTPUT="Creating default alias: default -> 0.2 (-> iojs-v0.2.10)"
|
EXPECTED_OUTPUT="Creating default alias: default -> 0.2 (-> iojs-v0.2.10)"
|
||||||
EXIT_CODE="$?"
|
EXIT_CODE="$?"
|
||||||
|
|
||||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set 0.2' did not output '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
[ "_$(echo "$OUTPUT" | strip_colors)" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set 0.2' did not output '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||||
[ "_$EXIT_CODE" = "_0" ] || die "'nvm_ensure_default_set 0.2' did not exit with 0, got $EXIT_CODE"
|
[ "_$EXIT_CODE" = "_0" ] || die "'nvm_ensure_default_set 0.2' did not exit with 0, got $EXIT_CODE"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ../../common.sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
@ -7,7 +9,7 @@ die () { echo $@ ; exit 1; }
|
||||||
EXPECTED_OUTPUT="nvm_ensure_default_set: a version is required"
|
EXPECTED_OUTPUT="nvm_ensure_default_set: a version is required"
|
||||||
OUTPUT="$(nvm_ensure_default_set 2>&1 >/dev/null)"
|
OUTPUT="$(nvm_ensure_default_set 2>&1 >/dev/null)"
|
||||||
EXIT_CODE="$?"
|
EXIT_CODE="$?"
|
||||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set' did not output "$EXPECTED_OUTPUT", got "$OUTPUT""
|
[ "_$(echo "$OUTPUT" | strip_colors)" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set' did not output "$EXPECTED_OUTPUT", got "$OUTPUT""
|
||||||
[ "_$EXIT_CODE" = "_1" ] || die "'nvm_ensure_default_set' did not exit with 1, got "$EXIT_CODE""
|
[ "_$EXIT_CODE" = "_1" ] || die "'nvm_ensure_default_set' did not exit with 1, got "$EXIT_CODE""
|
||||||
|
|
||||||
# see test/fast/Aliases for remaining nvm_ensure_default_set tests
|
# see test/fast/Aliases for remaining nvm_ensure_default_set tests
|
||||||
|
|
Loading…
Reference in New Issue