summary refs log tree commit diff
path: root/synctl
diff options
context:
space:
mode:
authorTravis Ralston <travpc@gmail.com>2018-10-18 09:57:58 -0600
committerTravis Ralston <travpc@gmail.com>2018-10-18 09:57:58 -0600
commit49a044aa5f7a89594fca5556236126208ff7aa1c (patch)
treeab8f3bdea5294ed08bad2f5ab640063fbfd479e6 /synctl
parentpep8 (diff)
parentremove redundant changelog file (diff)
downloadsynapse-49a044aa5f7a89594fca5556236126208ff7aa1c.tar.xz
Merge branch 'develop' into travis/login-terms
Diffstat (limited to 'synctl')
-rwxr-xr-xsynctl11
1 files changed, 10 insertions, 1 deletions
diff --git a/synctl b/synctl

index 09b64459b1..4bd4c68b37 100755 --- a/synctl +++ b/synctl
@@ -48,7 +48,16 @@ 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 + try: + should_colour = stream.isatty() + except AttributeError: + # Just in case `isatty` isn't defined on everything. The python + # docs are incredibly vague. + pass + + if not should_colour: stream.write(message + "\n") else: stream.write(colour + message + NORMAL + "\n")