Mercurial > hg
comparison mercurial/progress.py @ 44033:4e0a6d157910 stable
progress: flush stderr after clearing
On python3, ui.stderr is buffered, it seems, so we need to flush it to actually
get the progress bar off the screen. This is important since ui.write() will
call into progbar.clear() if it thinks there's a progress bar on the screen,
with the intent that the next thing it outputs is at the beginning of the line
(instead of at the end of the progress bar line). Without the flush, we buffer
up the clearing of the screen, and we get some really weird/corrupt output.
Differential Revision: https://phab.mercurial-scm.org/D7784
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 02 Jan 2020 17:27:37 -0800 |
parents | 687b865b95ad |
children | 89a2afe31e82 |
comparison
equal
deleted
inserted
replaced
44015:7ca8aa8840c0 | 44033:4e0a6d157910 |
---|---|
191 | 191 |
192 def clear(self): | 192 def clear(self): |
193 if not self.printed or not self.lastprint or not shouldprint(self.ui): | 193 if not self.printed or not self.lastprint or not shouldprint(self.ui): |
194 return | 194 return |
195 self._writeerr(b'\r%s\r' % (b' ' * self.width())) | 195 self._writeerr(b'\r%s\r' % (b' ' * self.width())) |
196 self._flusherr() | |
196 if self.printed: | 197 if self.printed: |
197 # force immediate re-paint of progress bar | 198 # force immediate re-paint of progress bar |
198 self.lastprint = 0 | 199 self.lastprint = 0 |
199 | 200 |
200 def complete(self): | 201 def complete(self): |