Patchwork D7784: progress: flush stderr after clearing

login
register
mail settings
Submitter phabricator
Date Jan. 3, 2020, 1:30 a.m.
Message ID <differential-rev-PHID-DREV-lknd6gn32yysap2el7jp-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44143/
State Superseded
Headers show

Comments

phabricator - Jan. 3, 2020, 1:30 a.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7784

AFFECTED FILES
  mercurial/progress.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/progress.py b/mercurial/progress.py
--- a/mercurial/progress.py
+++ b/mercurial/progress.py
@@ -193,6 +193,7 @@ 
         if not self.printed or not self.lastprint or not shouldprint(self.ui):
             return
         self._writeerr(b'\r%s\r' % (b' ' * self.width()))
+        self._flusherr()
         if self.printed:
             # force immediate re-paint of progress bar
             self.lastprint = 0