On Thu, 2 Feb 2017 11:18:57 -0800, Simon Farnsworth wrote: > # HG changeset patch > # User Simon Farnsworth <simon...@fb.com> > # Date 1486063056 28800 > # Thu Feb 02 11:17:36 2017 -0800 > # Node ID 722c309600ed9596a02674b04cb2caa9a65e8918 > # Parent 12d0ac224bb34691d44a2cead5b9795a6cfc2490 > util: always force line buffered stdout when stdout is a tty (BC) > > pager replaced stdout with a line buffered version to work around glibc > deciding on a buffering strategy on the first write to stdout. This is going > to make my next patch hard, as replacing stdout will make tracking time > spent blocked on it more challenging. > > Move the line buffering requirement to util.py, and remove it from pager. > This means that the abuse of ui.formatted=True and pager set to cat or > equivalent > no longer results in a line-buffered output to a pipe, hence (BC), although > I don't expect anyone to be affected
Sounds okay. A few nits follow. > --- a/mercurial/util.py > +++ b/mercurial/util.py > @@ -69,6 +69,12 @@ > else: > from . import posix as platform > > +# glibc determines buffering on first write to stdout - if we replace a TTY > +# destined stdout with a pipe destined stdout (e.g. pager), we want line > +# buffering > +if stdout.isatty(): stdout might be replaced with a file-like object. Can we use util.isatty() ? > + stdout = os.fdopen(stdout.fileno(), 'wb', 1) Perhaps this should be done before stdout is wrapped by winstdout(). _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel