From 2f20264768bf6000e6edd485afa533ed8b4826a2 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Mon, 19 Dec 2016 11:21:43 -0800 Subject: utils: use vt100 terminal codes in uhd_images_downloader --- host/utils/uhd_images_downloader.py.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'host/utils') 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) -- cgit v1.2.3