changeset 24249:5058e6962fcc

color: omit terminfo/win32 warning if non-interactive (issue4543) It's pretty annoying to be getting this warning when already the colour extension has no hope of working. If there isn't a human on the other end to to see the colours, there probably isn't a human either who cares about this warning. More likely, some script somewhere is gonna get confused with the warning output. Of course, if we still want to see the warning for some reason, we can always set --config ui.interactive=True.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 10 Mar 2015 13:40:14 -0400
parents 913347bcd59c
children 9c32eea2ca04
files hgext/color.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Thu Feb 26 20:54:05 2015 +0900
+++ b/hgext/color.py	Tue Mar 10 13:40:14 2015 -0400
@@ -254,7 +254,7 @@
     if realmode == 'win32':
         _terminfo_params = {}
         if not w32effects:
-            if mode == 'win32':
+            if mode == 'win32' and ui.interactive():
                 # only warn if color.mode is explicitly set to win32
                 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
             return None
@@ -264,7 +264,7 @@
     elif realmode == 'terminfo':
         _terminfosetup(ui, mode)
         if not _terminfo_params:
-            if mode == 'terminfo':
+            if mode == 'terminfo' and ui.interactive():
                 ## FIXME Shouldn't we return None in this case too?
                 # only warn if color.mode is explicitly set to win32
                 ui.warn(_('warning: failed to set color mode to %s\n') % mode)