aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdists/openpandora/pnd_make.sh10
1 files 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
}