summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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']