summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-07-10 11:26:19 +0300
committerGuido Günther <agx@sigxcpu.org>2014-12-05 15:52:39 +0100
commit7df4d8cf8897474e6d7e897c8b273b55c13b1d7a (patch)
tree5b6602305610f945eff0bca77dafe1daed8a0b0c /gbp
parentf48f0ff3fdf636f9e11d0be9c558a1341e7cd5fa (diff)
log: fix auto colorizing for custom streams
Check for existence of isatty() method in the stream object. Some custom streams (e.g. in nose) do not necessarily have this. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rw-r--r--gbp/log.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gbp/log.py b/gbp/log.py
index f21e2bb..6d2c0a6 100644
--- a/gbp/log.py
+++ b/gbp/log.py
@@ -75,7 +75,7 @@ class GbpStreamHandler(logging.StreamHandler):
"""Check if to print in color or not"""
if self._color.is_on():
return True
- elif self._color.is_auto():
+ elif self._color.is_auto() and hasattr(self.stream, 'isatty'):
in_emacs = (os.getenv("EMACS") and
os.getenv("INSIDE_EMACS", "").endswith(",comint"))
return self.stream.isatty() and not in_emacs