From 01a76df6e3b1ffd95b6a0febfb77bd6003f9441a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 29 Feb 2016 18:45:40 +0100 Subject: OPENPANDORA: Don't output colors in pnd_make.sh when redirecting output to file. --- dists/openpandora/pnd_make.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dists/openpandora/pnd_make.sh b/dists/openpandora/pnd_make.sh index 202f137acc..f077c42d0e 100755 --- a/dists/openpandora/pnd_make.sh +++ b/dists/openpandora/pnd_make.sh @@ -42,14 +42,14 @@ cecho () # Color-echo. Argument $1 = message, Argument $2 = color local default_msg="No message passed." # Doesn't really need to be a local variable. message=${1:-$default_msg} # Defaults to default message. - # We only output colors when a TERM environment variable is set. This - # fixes execution of the script on buildbot, which does not have this set. - if [ -z "$TERM" ]; then - echo "$message" - else + # We only output colors when stdout is outputting to a terminal. + # This avoids color codes being output in log files created on buildbot. + if [ -t 1 ]; then color=${2:-$black} # Defaults to black, if not specified. echo -e "$color$message" tput sgr0 # Reset to normal. + else + echo "$message" fi return } -- cgit v1.2.3