Index: test/tools/llvm-objcopy/Inputs/ungzip.py =================================================================== --- test/tools/llvm-objcopy/Inputs/ungzip.py +++ test/tools/llvm-objcopy/Inputs/ungzip.py @@ -2,4 +2,12 @@ import sys with gzip.open(sys.argv[1], 'rb') as f: - sys.stdout.write(f.read()) + writer = getattr(sys.stdout, 'buffer', None) + if writer is None: + writer = sys.stdout + if sys.platform == "win32": + import os, msvcrt + msvcrt.setmode(sys.stdout.fileno(),os.O_BINARY) + + writer.write(f.read()) + sys.stdout.flush()