diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -107,11 +107,11 @@ def write(self, s): write1 = self.orig.write - m = memoryview(s) - total_to_write = len(s) + v = encoding.strfromlocal(s) + total_to_write = len(v) total_written = 0 while total_written < total_to_write: - c = write1(m[total_written:]) + c = write1(v[total_written:]) if c: total_written += c return total_written @@ -147,11 +147,11 @@ if sys.stdout is None: stdout = BadFile() else: - stdout = _make_write_all(sys.stdout.buffer) + stdout = _make_write_all(getattr(sys.stdout, 'buffer', sys.stdout)) if sys.stderr is None: stderr = BadFile() else: - stderr = _make_write_all(sys.stderr.buffer) + stderr = _make_write_all(getattr(sys.stderr, 'buffer', sys.stderr)) if pycompat.iswindows: # Work around Windows bugs.