D7948: debugcommands: move away from line buffered output on binary stream
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Tue Jan 21 08:04:24 EST 2020
Closed by commit rHG2ae43bc51483: debugcommands: move away from line buffered output on binary stream (authored by indygreg).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D7948?vs=19452&id=19471
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D7948/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D7948
AFFECTED FILES
mercurial/debugcommands.py
CHANGE DETAILS
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3218,16 +3218,19 @@
raise error.Abort(_(b'cannot use both --logiofd and --logiofile'))
if opts[b'logiofd']:
- # Line buffered because output is line based.
+ # Ideally we would be line buffered. But line buffering in binary
+ # mode isn't supported and emits a warning in Python 3.8+. Disabling
+ # buffering could have performance impacts. But since this isn't
+ # performance critical code, it should be fine.
try:
- logfh = os.fdopen(int(opts[b'logiofd']), 'ab', 1)
+ logfh = os.fdopen(int(opts[b'logiofd']), 'ab', 0)
except OSError as e:
if e.errno != errno.ESPIPE:
raise
# can't seek a pipe, so `ab` mode fails on py3
- logfh = os.fdopen(int(opts[b'logiofd']), 'wb', 1)
+ logfh = os.fdopen(int(opts[b'logiofd']), 'wb', 0)
elif opts[b'logiofile']:
- logfh = open(opts[b'logiofile'], b'ab', 1)
+ logfh = open(opts[b'logiofile'], b'ab', 0)
s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
s.serve_forever()
To: indygreg, #hg-reviewers, pulkit
Cc: mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list