aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2016-12-19 11:21:43 -0800
committerMartin Braun <martin.braun@ettus.com>2017-01-03 14:05:33 -0800
commit2f20264768bf6000e6edd485afa533ed8b4826a2 (patch)
treecf926f042ecc825ae6c95019c0f1b788e1ef64c0
parent707e503d862486a9c8a4600a1af08811d6aa821b (diff)
downloaduhd-2f20264768bf6000e6edd485afa533ed8b4826a2.tar.gz
uhd-2f20264768bf6000e6edd485afa533ed8b4826a2.tar.bz2
uhd-2f20264768bf6000e6edd485afa533ed8b4826a2.zip
utils: use vt100 terminal codes in uhd_images_downloader
-rw-r--r--host/utils/uhd_images_downloader.py.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in
index 7a3ff8ddf..593f7759f 100644
--- a/host/utils/uhd_images_downloader.py.in
+++ b/host/utils/uhd_images_downloader.py.in
@@ -91,8 +91,12 @@ class uhd_images_downloader():
filesize_dl += len(buff)
if print_progress:
status = r"%05d kB / %05d kB (%03d%%)" % (int(math.ceil(filesize_dl/1000.)), int(math.ceil(filesize/1000.)), int(math.ceil(filesize_dl*100.)/filesize))
- status += chr(8)*(len(status)+1)
+ if os.name == "nt":
+ status += chr(8)*(len(status)+1)
+ else:
+ sys.stdout.write("\x1b[2K\r") #Clear previos line
sys.stdout.write(status)
+ sys.stdout.flush()
if print_progress:
print('')
return (filesize, filesize_dl)