diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-04-29 11:05:23 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-04-29 11:05:23 +0200 |
commit | 5455b5edefd5f1d6b99ca5f5d1b9d471df25045b (patch) | |
tree | cd0034866d74ca6d77d98cec008b1e16f31c97b5 /fb.py | |
parent | e3ea50ffbf3567247e2779d61eb1293e967be1d5 (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-x | fb.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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'] |