summaryrefslogtreecommitdiffstats
path: root/fb.py
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-04-29 11:05:23 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-04-29 11:05:23 +0200
commit5455b5edefd5f1d6b99ca5f5d1b9d471df25045b (patch)
treecd0034866d74ca6d77d98cec008b1e16f31c97b5 /fb.py
parente3ea50ffbf3567247e2779d61eb1293e967be1d5 (diff)
Disable progress bar if output is not a terminalv2.0.0
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.py')
-rwxr-xr-xfb.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/fb.py b/fb.py
index c1e4c5e..1557ed9 100755
--- a/fb.py
+++ b/fb.py
@@ -239,6 +239,10 @@ class ProgressBar:
def __init__(self):
samplecount = 20
+ self.display_progress = True
+ if not sys.stderr.isatty():
+ self.display_progress = False
+
self.progressData = {
"lastUpdateTime": time.time(),
"ullast": 0,
@@ -259,6 +263,9 @@ class ProgressBar:
data = self.progressData
assert data["ulGlobalTotal"] > 0
+ if not self.display_progress:
+ return
+
# update values here because if we carry one progress bar over multiple
# requests we could miss update when running after the rate limiter
uldiff = ulnow - data['ullast']