mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2024-09-27 04:54:58 +00:00
Set STDOUT to binary mode on Windows if needed
This commit is contained in:
parent
ffd96a8c2f
commit
382a6a218b
@ -67,6 +67,12 @@ def run_all():
|
|||||||
outfile = Ophis.CmdLine.outfile
|
outfile = Ophis.CmdLine.outfile
|
||||||
if outfile == '-':
|
if outfile == '-':
|
||||||
output = sys.stdout
|
output = sys.stdout
|
||||||
|
if sys.platform == "win32":
|
||||||
|
# We can't dump our binary in test mode; that would be
|
||||||
|
# disastrous. So, we'll do some platform-specific
|
||||||
|
# things here to force our stdout to binary mode.
|
||||||
|
import os, msvcrt
|
||||||
|
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||||
elif outfile is None:
|
elif outfile is None:
|
||||||
output = file('ophis.bin', 'wb')
|
output = file('ophis.bin', 'wb')
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user