Bug 878089 - mach shouldn't fail if terminal couldn't be configured; r=ted
authorGregory Szorc <gps@mozilla.com>
Mon, 10 Jun 2013 16:16:25 -0700
changeset 134578 6fac977ad9eaea999bd9bb02c7f9de5213251170
parent 134577 ca991d0bb5eadbc965412d810029880283ab56df
child 134579 92b758cba0f17448b274a6fab3061b11adf20b44
push id29281
push usergszorc@mozilla.com
push dateMon, 10 Jun 2013 23:17:01 +0000
treeherdermozilla-inbound@6fac977ad9ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs878089
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 878089 - mach shouldn't fail if terminal couldn't be configured; r=ted DONTBUILD (NPOTB)
python/mach/mach/logging.py
--- a/python/mach/mach/logging.py
+++ b/python/mach/mach/logging.py
@@ -145,20 +145,25 @@ class LoggingManager(object):
 
         self.structured_loggers = [self.mach_logger]
 
         self._terminal = None
 
     @property
     def terminal(self):
         if not self._terminal and blessings:
-            terminal = blessings.Terminal(stream=sys.stdout)
+            # Sometimes blessings fails to set up the terminal. In that case,
+            # silently fail.
+            try:
+                terminal = blessings.Terminal(stream=sys.stdout)
 
-            if terminal.is_a_tty:
-                self._terminal = terminal
+                if terminal.is_a_tty:
+                    self._terminal = terminal
+            except Exception:
+                pass
 
         return self._terminal
 
     def add_json_handler(self, fh):
         """Enable JSON logging on the specified file object."""
 
         # Configure the consumer of structured messages.
         handler = logging.StreamHandler(stream=fh)