[plugin] binary sys.stdout/err on win32
Martin Pool
mbp at canonical.com
Mon Jun 19 09:19:50 BST 2006
On 18 Jun 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> I just created a very simple plugin which sets sys.stdout and stderr to
> binary for win32.
>
> This is the sum total of the code:
>
> import sys
>
> if sys.platform in ('win32', 'cygwin'):
> try:
> import msvcrt, os
> except ImportError:
> pass
> else:
> msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
> msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
Presumably we should set stdin as well? Or does it do no conversion
there?
Well, I'd put the most weight on what Alexander or other full-time
Windows developers think would work. But to me it seems like a
reasonable approach that we should get the streams in binary mode at the
top level and then do conversion ourselves as and when necessary; it
makes the divergence between platforms smaller.
--
Martin
More information about the bazaar
mailing list