mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #1558 from baijum/non_tty_stdout
sys.stdout could be StringIO or fake object
This commit is contained in:
commit
24d39d34f6
@ -92,7 +92,12 @@ def get_colors(use=True):
|
||||
'ENDC': '\033[0m',
|
||||
}
|
||||
|
||||
if not use or not os.isatty(sys.stdout.fileno()):
|
||||
try:
|
||||
fileno = sys.stdout.fileno()
|
||||
except AttributeError:
|
||||
fileno = -1 # sys.stdout is StringIO or fake
|
||||
|
||||
if not use or not os.isatty(fileno):
|
||||
for color in colors:
|
||||
colors[color] = ''
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user