# HG changeset patch # User Augie Fackler # Date 1659796887 14400 # Node ID a5a4f9e12c9faf350343a0adb530987db7e030b7 # Parent 7983184eb8d8fdb3cb628c827b3ca3a9f0c60e1d patchpipe: py3 support diff --git a/unixSoft/bin/patchpipe b/unixSoft/bin/patchpipe --- a/unixSoft/bin/patchpipe +++ b/unixSoft/bin/patchpipe @@ -5,14 +5,14 @@ import subprocess import sys import tempfile -_PATCHHDR = '# HG changeset patch' +_PATCHHDR = b'# HG changeset patch' -_BASE64_MAGIC = 'Content-Transfer-Encoding: base64' +_BASE64_MAGIC = b'Content-Transfer-Encoding: base64' def main(argv): tf = tempfile.NamedTemporaryFile(suffix='.diff') - d = sys.stdin.read() + d = sys.stdin.buffer.read() if _PATCHHDR in d: junk, d = d.split(_PATCHHDR, 1) d = _PATCHHDR + d @@ -23,7 +23,7 @@ def main(argv): tf.flush() subprocess.check_call([os.environ['EDITOR'], tf.name], stdout=sys.stderr) - sys.stdout.write(open(tf.name).read()) + sys.stdout.buffer.write(open(tf.name, 'rb').read()) if __name__ == '__main__':