Hide get.py download percent when not interactive (#6852)
When get.py is run in a script the percent-update printouts shown while downloading the toolchain end up as 100s to 1000s of lines in log files. When stdout is not a terminal, avoid printing these percentages and shrink logfiles significantly. Errors/etc. are still reported as normal.
This commit is contained in:
parent
99520f66f6
commit
0480112a15
1 changed files with 5 additions and 4 deletions
|
|
@ -53,6 +53,7 @@ def mkdir_p(path):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def report_progress(count, blockSize, totalSize):
|
def report_progress(count, blockSize, totalSize):
|
||||||
|
if sys.stdout.isatty():
|
||||||
percent = int(count*blockSize*100/totalSize)
|
percent = int(count*blockSize*100/totalSize)
|
||||||
percent = min(100, percent)
|
percent = min(100, percent)
|
||||||
sys.stdout.write("\r%d%%" % percent)
|
sys.stdout.write("\r%d%%" % percent)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue