diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-07-10 11:26:19 +0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-12-05 15:52:39 +0100 |
commit | 7df4d8cf8897474e6d7e897c8b273b55c13b1d7a (patch) | |
tree | 5b6602305610f945eff0bca77dafe1daed8a0b0c /gbp | |
parent | f48f0ff3fdf636f9e11d0be9c558a1341e7cd5fa (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.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 |