Only add terminal colors with DEBUG if stdout is a tty

This commit is contained in:
Matt Martz 2018-01-08 16:57:26 -06:00
parent 48a3d33ae4
commit e1bab1ab55
1 changed files with 4 additions and 1 deletions

View File

@ -1653,7 +1653,10 @@ def printer(string, quiet=False, debug=False, error=False, **kwargs):
return return
if debug: if debug:
out = '\033[1;30mDEBUG: %s\033[0m' % string if sys.stdout.isatty():
out = '\033[1;30mDEBUG: %s\033[0m' % string
else:
out = 'DEBUG: %s' % string
else: else:
out = string out = string