Manuel Jacob <me@manueljacob.de> [Sun, 05 Jul 2020 13:09:22 +0200] rev 45045
procutil: make mercurial.utils.procutil.stderr unbuffered
For most Mercurial code, it doesn’t make a difference, as the ui object flushes
stderr explicitly (after the change, we could get rid of the explicit flush).
One example where it makes a observable difference is mercurial.util.timed().
Without the patch, the time is not immediately shown on Python 3. With the
patch, it’s shown immediately on all Python versions and platforms.
Manuel Jacob <me@manueljacob.de> [Sun, 05 Jul 2020 13:05:06 +0200] rev 45044
tests: generalize common test case code in test-stdio.py
Manuel Jacob <me@manueljacob.de> [Sat, 04 Jul 2020 11:41:39 +0200] rev 45043
procutil: make stdout line-buffered on Windows if connected to TTY
Windows doesn’t support line buffering. Previously, we worked around that by
setting the stream unbuffered. Instead, we can use our own line buffering we
already use on Python 3.
Manuel Jacob <me@manueljacob.de> [Sat, 04 Jul 2020 11:21:44 +0200] rev 45042
procutil: split import and reassignment
Besides making the code clearer, it will reduce the diff in the next patch.
Manuel Jacob <me@manueljacob.de> [Sat, 04 Jul 2020 11:15:58 +0200] rev 45041
procutil: move assignments closer to reassignments
Doing reassignments is an anti-pattern IMHO, but I see how it makes sense here.
When first looking at this code after jumping here with ctags, I missed the
fact that stdout was reassigned. To make the code clearer, the assignments
should be as close as possible to the reassignments.
Manuel Jacob <me@manueljacob.de> [Sat, 04 Jul 2020 12:15:41 +0200] rev 45040
procutil: factor out conditional creation of LineBufferedWrapper
At the same time, document the logic and generalize it to work on all Python
versions.