Need to use binary stdin and stdout on Windows

Bug #579296 reported by Martin Packman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subunit
Fix Released
Critical
Robert Collins

Bug Description

Before bug 505078 is fixed and subunit starts using a format resilient against newline mangling, subunit scripts need to change the mode of stdin and stdout to binary.

The short and hacky way to do this is something like:

import os, sys

...

if __name__ == "__main__":
    if sys.platform == "win32":
        import msvcrt
        for f in (sys.stdin, sys.stdout):
            msvcrt.setmode(f.fileno(), os.O_BINARY)
    main()

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 579296] [NEW] Need to use binary stdin and stdout on Windows

thanks, thats great. We'll need to apply this to all the filters.
*might* want to optimistically try to do it on streams we're given.
What do you think?

Changed in subunit:
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → Robert Collins (lifeless)
milestone: none → next
Changed in subunit:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.