Browse Source

Don't colour warnings when outputting to a file

Fixes #21548.
teor 7 years ago
parent
commit
23b5d63ebd
1 changed files with 6 additions and 3 deletions
  1. 6 3
      tools/warnings.sh

+ 6 - 3
tools/warnings.sh

@@ -48,9 +48,12 @@ function usage() {
     exit 1
 }
 
-NC=$(tput sgr0)
-YELLOW=$(tput setaf 3)
-GREEN=$(tput setaf 2)
+# Don't colour in log files
+if [ -t 1 ]; then
+    NC=$(tput sgr0)
+    YELLOW=$(tput setaf 3)
+    GREEN=$(tput setaf 2)
+fi
 CHUTNEY="$CHUTNEY_PATH/chutney"
 NAME=$(basename "$0")
 DEST="$CHUTNEY_PATH/net/nodes"