~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/medium.py

merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
import os
28
28
import socket
 
29
import sys
29
30
 
30
31
from bzrlib import errors
31
32
from bzrlib.smart import protocol
137
138
        :param backing_transport: Transport for the directory served.
138
139
        """
139
140
        SmartServerStreamMedium.__init__(self, backing_transport)
 
141
        if sys.platform == 'win32':
 
142
            # force binary mode for files
 
143
            import msvcrt
 
144
            for f in (in_file, out_file):
 
145
                fileno = getattr(f, 'fileno', None)
 
146
                if fileno:
 
147
                    msvcrt.setmode(fileno(), os.O_BINARY)
140
148
        self._in = in_file
141
149
        self._out = out_file
142
150