Tools: improve uploader output in scripts

When the px_uploader.py is used scripted, so without an interactive
shell, the progress bar doesn't update. Therefore, I suggest to print a
new line instead of a carriage return for the non-interactive shell
case.
This commit is contained in:
Julian Oes
2024-10-04 13:26:17 +13:00
parent b390d5876a
commit f55c3b890b
+2 -1
View File
@@ -428,7 +428,8 @@ class uploader:
percent = (float(progress) / float(maxVal)) * 100.0
sys.stdout.write("\r%s: [%-20s] %.1f%%" % (label, '='*int(percent/5.0), percent))
redraw = "\r" if sys.stdout.isatty() else "\n"
sys.stdout.write("%s%s: [%-20s] %.1f%%" % (redraw, label, '='*int(percent/5.0), percent))
sys.stdout.flush()
# send the CHIP_ERASE command and wait for the bootloader to become ready