Mercurial > public > mercurial-scm > hg-stable
changeset 52976:c636f2835c95
stream-bundle: make sure to open the file in binary mode
Windows need an additional flag to open the file properly.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 19 Feb 2025 01:13:00 +0100 |
parents | e4ff37b5317c |
children | 40c5e29f817a |
files | mercurial/streamclone.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/streamclone.py Tue Feb 18 17:21:42 2025 +0100 +++ b/mercurial/streamclone.py Wed Feb 19 01:13:00 2025 +0100 @@ -1544,11 +1544,14 @@ def _write_files(info: Iterable[FileInfoT]): """write files from parsed data""" + io_flags = os.O_WRONLY | os.O_CREAT + if pycompat.iswindows: + io_flags |= os.O_BINARY for path, mode, data in info: if mode is None: - fd = os.open(path, os.O_WRONLY | os.O_CREAT) + fd = os.open(path, io_flags) else: - fd = os.open(path, os.O_WRONLY | os.O_CREAT, mode=mode) + fd = os.open(path, io_flags, mode=mode) try: for chunk in data: written = os.write(fd, chunk)