aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-01 21:12:45 -0600
committerSimon Glass <sjg@chromium.org>2018-10-08 07:34:34 -0600
commit008b03000935c397fd604cc62a6813bcd72a30fc (patch)
treefefcee35b20af417687d105f531fb8628a8f9692
parent1fda18205ff425d00faad57dc2ad69995cdbd15d (diff)
downloadu-boot-008b03000935c397fd604cc62a6813bcd72a30fc.zip
u-boot-008b03000935c397fd604cc62a6813bcd72a30fc.tar.gz
u-boot-008b03000935c397fd604cc62a6813bcd72a30fc.tar.bz2
patman: Don't clear progress in tout unless it was used
At present calling Uninit() always called ClearProgress() which outputs a \r character as well as spaces to remove any progress information on the line. This can mess up the normal output of binman and other tools. Fix this by outputing this only when progress information has actually been previous written. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--tools/patman/tout.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index 4cd49e1..4957c7a 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -15,6 +15,8 @@ NOTICE = 2
INFO = 3
DEBUG = 4
+in_progress = False
+
"""
This class handles output of progress and other useful information
to the user. It provides for simple verbosity level control and can
@@ -48,9 +50,11 @@ def UserIsPresent():
def ClearProgress():
"""Clear any active progress message on the terminal."""
- if verbose > 0 and stdout_is_tty:
+ global in_progress
+ if verbose > 0 and stdout_is_tty and in_progress:
_stdout.write('\r%s\r' % (" " * len (_progress)))
_stdout.flush()
+ in_progress = False
def Progress(msg, warning=False, trailer='...'):
"""Display progress information.
@@ -58,6 +62,7 @@ def Progress(msg, warning=False, trailer='...'):
Args:
msg: Message to display.
warning: True if this is a warning."""
+ global in_progress
ClearProgress()
if verbose > 0:
_progress = msg + trailer
@@ -65,6 +70,7 @@ def Progress(msg, warning=False, trailer='...'):
col = _color.YELLOW if warning else _color.GREEN
_stdout.write('\r' + _color.Color(col, _progress))
_stdout.flush()
+ in_progress = True
else:
_stdout.write(_progress + '\n')