Explorar o código

detect terminal output with 'test -t' in tests

Instead of trying to inspect /proc and the fds inside we use "test -t 1"
instead as this is available and working on kfreebsd as well – not that
something breaks if we wouldn't, but we like color.

Git-Dch: Ignore
David Kalnischkies %!s(int64=12) %!d(string=hai) anos
pai
achega
27cb4f6c91
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      test/integration/framework
  2. 1 1
      test/integration/run-tests

+ 1 - 1
test/integration/framework

@@ -4,7 +4,7 @@ EXIT_CODE=0
 
 # we all like colorful messages
 if [ "$MSGCOLOR" != 'NO' ]; then
-	if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
+	if [ ! -t 1 ]; then # but check that we output to a terminal
 		export MSGCOLOR='NO'
 	fi
 fi

+ 1 - 1
test/integration/run-tests

@@ -22,7 +22,7 @@ done
 export MSGLEVEL="${MSGLEVEL:-3}"
 
 if [ "$MSGCOLOR" != 'NO' ]; then
-	if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
+	if [ ! -t 1 ]; then # but check that we output to a terminal
 		export MSGCOLOR='NO'
 	fi
 fi