Skip to content
Snippets Groups Projects
Commit df33c164 authored by Erik Johnston's avatar Erik Johnston
Browse files

Only colourise synctl output when attached to tty

parent d6a7797d
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,12 @@ def pid_running(pid):
def write(message, colour=NORMAL, stream=sys.stdout):
if colour == NORMAL:
# Lets check if we're writing to a TTY before colouring
should_colour = False
if stream in (sys.stdout, sys.stderr):
should_colour = stream.isatty()
if not should_colour or colour == NORMAL:
stream.write(message + "\n")
else:
stream.write(colour + message + NORMAL + "\n")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment