From: Markus Lehtonen Date: Thu, 10 Jul 2014 08:26:19 +0000 (+0300) Subject: log: fix auto colorizing for custom streams X-Git-Tag: debian/0.6.25~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2faed835d50d24630de2d756bd0325f9b9a9c480;p=tools%2Fgit-buildpackage.git 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 --- diff --git a/gbp/log.py b/gbp/log.py index e269d65..17cd680 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