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,10 +53,11 @@ def mkdir_p(path):
|
|||
raise
|
||||
|
||||
def report_progress(count, blockSize, totalSize):
|
||||
percent = int(count*blockSize*100/totalSize)
|
||||
percent = min(100, percent)
|
||||
sys.stdout.write("\r%d%%" % percent)
|
||||
sys.stdout.flush()
|
||||
if sys.stdout.isatty():
|
||||
percent = int(count*blockSize*100/totalSize)
|
||||
percent = min(100, percent)
|
||||
sys.stdout.write("\r%d%%" % percent)
|
||||
sys.stdout.flush()
|
||||
|
||||
def unpack(filename, destination):
|
||||
dirname = ''
|
||||
|
|
|
|||
Loading…
Reference in a new issue