From d177aac02f8368d6f9b5697821e33db7eb1521c6 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 30 Jan 2015 21:13:01 +0800
Subject: [PATCH 2/5] testenv: improve color output a bit.

 * testenv/misc/colour_terminal.py:

     - Darwin platform also supports colorful terminal output.
     - Only print color codes when stdout isatty().
---
 testenv/misc/colour_terminal.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/testenv/misc/colour_terminal.py b/testenv/misc/colour_terminal.py
index b0849c1..ca7a57c 100644
--- a/testenv/misc/colour_terminal.py
+++ b/testenv/misc/colour_terminal.py
@@ -1,6 +1,7 @@
 from functools import partial
 import platform
 from os import getenv
+import sys
 
 """ This module allows printing coloured output to the terminal when running a
 Wget Test under certain conditions.
@@ -25,11 +26,11 @@ T_COLORS = {
     'ENDC'   : '\033[0m'
 }
 
-system = True if platform.system() == 'Linux' else False
+system = True if platform.system() in ( 'Linux', 'Darwin' ) else False
 check = False if getenv("MAKE_CHECK") == 'True' else True
 
 def printer (color, string):
-    if system and check:
+    if  sys.stdout.isatty() and system and check:
         print (T_COLORS.get (color) + string + T_COLORS.get ('ENDC'))
     else:
         print (string)
-- 
2.2.1

