##// END OF EJS Templates
debugcommands: move away from line buffered output on binary stream...
Gregory Szorc -
r44582:52f8b07a default
parent child Browse files
Show More
@@ -3218,16 +3218,19 b' def debugserve(ui, repo, **opts):'
3218 raise error.Abort(_(b'cannot use both --logiofd and --logiofile'))
3218 raise error.Abort(_(b'cannot use both --logiofd and --logiofile'))
3219
3219
3220 if opts[b'logiofd']:
3220 if opts[b'logiofd']:
3221 # Line buffered because output is line based.
3221 # Ideally we would be line buffered. But line buffering in binary
3222 # mode isn't supported and emits a warning in Python 3.8+. Disabling
3223 # buffering could have performance impacts. But since this isn't
3224 # performance critical code, it should be fine.
3222 try:
3225 try:
3223 logfh = os.fdopen(int(opts[b'logiofd']), 'ab', 1)
3226 logfh = os.fdopen(int(opts[b'logiofd']), 'ab', 0)
3224 except OSError as e:
3227 except OSError as e:
3225 if e.errno != errno.ESPIPE:
3228 if e.errno != errno.ESPIPE:
3226 raise
3229 raise
3227 # can't seek a pipe, so `ab` mode fails on py3
3230 # can't seek a pipe, so `ab` mode fails on py3
3228 logfh = os.fdopen(int(opts[b'logiofd']), 'wb', 1)
3231 logfh = os.fdopen(int(opts[b'logiofd']), 'wb', 0)
3229 elif opts[b'logiofile']:
3232 elif opts[b'logiofile']:
3230 logfh = open(opts[b'logiofile'], b'ab', 1)
3233 logfh = open(opts[b'logiofile'], b'ab', 0)
3231
3234
3232 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
3235 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
3233 s.serve_forever()
3236 s.serve_forever()
General Comments 0
You need to be logged in to leave comments. Login now