summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-07-10 11:26:19 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-07-18 16:08:28 +0300
commit2faed835d50d24630de2d756bd0325f9b9a9c480 (patch)
tree84f774f13783cc74b19ee894bbf42e5d155b4ba8
parent5ee9fb39bf41ab8f7c074becc15dcf3a3cb15449 (diff)
downloadgit-buildpackage-2faed835d50d24630de2d756bd0325f9b9a9c480.tar.gz
git-buildpackage-2faed835d50d24630de2d756bd0325f9b9a9c480.tar.bz2
git-buildpackage-2faed835d50d24630de2d756bd0325f9b9a9c480.zip
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. Change-Id: I4c8386dfd6f016f926f2eb70b953b19095d585c2 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/log.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gbp/log.py b/gbp/log.py
index e269d653..17cd680d 100644
--- a/gbp/log.py
+++ b/gbp/log.py
@@ -77,7 +77,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