Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sivel/speedtest-cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2018-01-09 01:57:26 +0300
committerMatt Martz <matt@sivel.net>2018-01-09 01:57:26 +0300
commite1bab1ab55470384e953cd8c4cf18b03c7082a21 (patch)
tree3f32e5d5eac17fada19acf3b02eaca0bdece9616
parent48a3d33ae478e218a5548a484b07e87413cc0c27 (diff)
Only add terminal colors with DEBUG if stdout is a tty
-rwxr-xr-xspeedtest.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/speedtest.py b/speedtest.py
index a0e7a80..d7172e1 100755
--- a/speedtest.py
+++ b/speedtest.py
@@ -1653,7 +1653,10 @@ def printer(string, quiet=False, debug=False, error=False, **kwargs):
return
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:
out = string