diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-07-10 11:26:19 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-07-18 16:08:28 +0300 |
commit | 2faed835d50d24630de2d756bd0325f9b9a9c480 (patch) | |
tree | 84f774f13783cc74b19ee894bbf42e5d155b4ba8 | |
parent | 5ee9fb39bf41ab8f7c074becc15dcf3a3cb15449 (diff) | |
download | git-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.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 |