##// END OF EJS Templates
color: use ui.formatted() to test TTYness, not sys.stdout.isatty()...
Brodie Rao -
r14103:a36e8c99 default
parent child Browse files
Show More
@@ -301,13 +301,15 b' def uisetup(ui):'
301 global _terminfo_params
301 global _terminfo_params
302 if ui.plain():
302 if ui.plain():
303 return
303 return
304
305 formatted = (os.environ.get('TERM') != 'dumb' and ui.formatted())
304 mode = ui.config('color', 'mode', 'auto')
306 mode = ui.config('color', 'mode', 'auto')
305 if mode == 'auto':
307 if mode == 'auto':
306 if os.name == 'nt' and 'TERM' not in os.environ:
308 if os.name == 'nt' and 'TERM' not in os.environ:
307 # looks line a cmd.exe console, use win32 API or nothing
309 # looks line a cmd.exe console, use win32 API or nothing
308 mode = w32effects and 'win32' or 'none'
310 mode = w32effects and 'win32' or 'none'
309 else:
311 else:
310 if getattr(sys.stdout, 'isatty', None) and sys.stdout.isatty():
312 if not formatted:
311 _terminfo_params = False
313 _terminfo_params = False
312 else:
314 else:
313 _terminfosetup(ui)
315 _terminfosetup(ui)
@@ -332,8 +334,7 b' def uisetup(ui):'
332 auto = coloropt == 'auto'
334 auto = coloropt == 'auto'
333 always = util.parsebool(coloropt)
335 always = util.parsebool(coloropt)
334 if (always or
336 if (always or
335 (always is None and
337 (always is None and auto and formatted)):
336 (auto and (os.environ.get('TERM') != 'dumb' and ui_.formatted())))):
337 colorui._colormode = mode
338 colorui._colormode = mode
338 colorui.__bases__ = (ui_.__class__,)
339 colorui.__bases__ = (ui_.__class__,)
339 ui_.__class__ = colorui
340 ui_.__class__ = colorui
General Comments 0
You need to be logged in to leave comments. Login now