summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-09-07 19:30:33 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-09-07 19:30:33 +0200
commit27cb4f6c919921b04f3dddff069620ced250a94f (patch)
tree38dafdf86c4a6a64797611b25a0ccdadbb10c659 /test
parente9bb097c914ff4fb1cdeda8a2843644dca184c56 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework2
-rwxr-xr-xtest/integration/run-tests2
2 files changed, 2 insertions, 2 deletions
diff --git a/test/integration/framework b/test/integration/framework
index fde74f55d..ff010a5c4 100644
--- a/test/integration/framework
+++ b/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
diff --git a/test/integration/run-tests b/test/integration/run-tests
index 9dd550aa2..c39a2ac68 100755
--- a/test/integration/run-tests
+++ b/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