Skip to content

Commit 70a4e64

Browse files
kcwuLUCI
authored andcommitted
progress: always show done message
The done message was omitted if the task is shorter than 0.5s. This might confuse users. Bug: b/371638995 Change-Id: I3fdd2cd8daea16d34fba88457d09397fff71af15 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/440222 Tested-by: Kuang-che Wu <[email protected]> Commit-Queue: Kuang-che Wu <[email protected]> Reviewed-by: Josip Sokcevic <[email protected]>
1 parent 8da4861 commit 70a4e64

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

progress.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def __init__(
100100
self._show = not delay
101101
self._units = units
102102
self._elide = elide and _TTY
103+
self._quiet = quiet
103104

104105
# Only show the active jobs section if we run more than one in parallel.
105106
self._show_jobs = False
@@ -114,13 +115,7 @@ def __init__(
114115
)
115116
self._update_thread.daemon = True
116117

117-
# When quiet, never show any output. It's a bit hacky, but reusing the
118-
# existing logic that delays initial output keeps the rest of the class
119-
# clean. Basically we set the start time to years in the future.
120-
if quiet:
121-
self._show = False
122-
self._start += 2**32
123-
elif show_elapsed:
118+
if not quiet and show_elapsed:
124119
self._update_thread.start()
125120

126121
def _update_loop(self):
@@ -160,7 +155,7 @@ def update(self, inc=1, msg=None):
160155
msg = self._last_msg
161156
self._last_msg = msg
162157

163-
if not _TTY or IsTraceToStderr():
158+
if not _TTY or IsTraceToStderr() or self._quiet:
164159
return
165160

166161
elapsed_sec = time.time() - self._start
@@ -202,7 +197,7 @@ def update(self, inc=1, msg=None):
202197

203198
def end(self):
204199
self._update_event.set()
205-
if not _TTY or IsTraceToStderr() or not self._show:
200+
if not _TTY or IsTraceToStderr() or self._quiet:
206201
return
207202

208203
duration = duration_str(time.time() - self._start)

0 commit comments

Comments
 (0)