Mercurial > dotfiles
diff unixSoft/bin/patchpipe @ 523:a5a4f9e12c9f
patchpipe: py3 support
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sat, 06 Aug 2022 10:41:27 -0400 |
parents | c7a9cd793e37 |
children |
line wrap: on
line diff
--- 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__':