Comments
Patch
@@ -1198,9 +1198,14 @@ class ui(object):
label = opts.get('label', b'')
msg = self.label(msg, label)
dest.write(msg)
+ # On Python 2, stdout and stderr are usually line buffered, but
# stderr may be buffered under win32 when redirected to files,
# including stdout.
- if dest is self._ferr and not getattr(self._ferr, 'closed', False):
+ # On Python 3, we use the underlying binary buffer, which does not
+ # support line buffering.
+ if (pycompat.ispy3 or dest is self._ferr) and not getattr(
+ dest, 'closed', False
+ ):
dest.flush()
except IOError as err:
if dest is self._ferr and err.errno in (