X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=ff18fae616b2aaf1a27dae10216309ded3006349;hb=3563079be37737aab084e957b494070eaea9c2f6;hp=068e1029e5f30272883c53556d89e3844e278c71;hpb=a1aea7272e3dd98c389402791617a00b92783f86;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 068e1029..ff18fae6 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -134,15 +134,7 @@ add_gnupg_home () # ' # . ./test-lib.sh || exit 1 -[ "x$ORIGINAL_TERM" != "xdumb" ] && ( - TERM=$ORIGINAL_TERM && - export TERM && - [ -t 1 ] && - tput bold >/dev/null 2>&1 && - tput setaf 1 >/dev/null 2>&1 && - tput sgr0 >/dev/null 2>&1 - ) && - color=t +color=maybe while test "$#" -ne 0 do @@ -183,6 +175,21 @@ else } fi +test -n "$COLORS_WITHOUT_TTY" || [ -t 1 ] || color= + +if [ -n "$color" ] && [ "$ORIGINAL_TERM" != 'dumb' ] && ( + TERM=$ORIGINAL_TERM && + export TERM && + tput bold + tput setaf + tput sgr0 + ) >/dev/null 2>&1 +then + color=t +else + color= +fi + if test -n "$color"; then say_color () { (