Explorar o código

fix bug #557585 GitFile breaks dulwich on Windows
fix is to add os.O_BINARY flag as os.open doesn't open files as binary
on this platform by default

anatoly techtonik %!s(int64=15) %!d(string=hai) anos
pai
achega
2557a65892
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      dulwich/file.py

+ 2 - 1
dulwich/file.py

@@ -89,7 +89,8 @@ class _GitFile(object):
     def __init__(self, filename, mode, bufsize):
         self._filename = filename
         self._lockfilename = '%s.lock' % self._filename
-        fd = os.open(self._lockfilename, os.O_RDWR | os.O_CREAT | os.O_EXCL)
+        fd = os.open(self._lockfilename,
+            os.O_RDWR | os.O_CREAT | os.O_EXCL | getattr(os, "O_BINARY", 0))
         self._file = os.fdopen(fd, mode, bufsize)
         self._closed = False