[tor-commits] [chutney/master] Don't colour warnings when outputting to a file

teor at torproject.org teor at torproject.org
Fri Feb 24 00:35:01 UTC 2017


commit 23b5d63ebdb450745a743fb2f403a912b008f176
Author: teor <teor2345 at gmail.com>
Date:   Fri Feb 24 11:19:33 2017 +1100

    Don't colour warnings when outputting to a file
    
    Fixes #21548.
---
 tools/warnings.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/warnings.sh b/tools/warnings.sh
index 6c2cbab..52187bd 100755
--- a/tools/warnings.sh
+++ b/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"





More information about the tor-commits mailing list