Mercurial > hg
changeset 45041:1053f878dd46
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.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sat, 04 Jul 2020 11:15:58 +0200 |
parents | fd205a9c358a |
children | c88577199023 |
files | mercurial/utils/procutil.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/utils/procutil.py Sat Jul 04 12:15:41 2020 +0200 +++ b/mercurial/utils/procutil.py Sat Jul 04 11:15:58 2020 +0200 @@ -37,10 +37,6 @@ osutil = policy.importmod('osutil') -stderr = pycompat.stderr -stdin = pycompat.stdin -stdout = pycompat.stdout - def isatty(fp): try: @@ -79,6 +75,10 @@ return LineBufferedWrapper(stream) +stderr = pycompat.stderr +stdin = pycompat.stdin +stdout = pycompat.stdout + # 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 (or unbuffered, on Windows)