1
0
forked from VimPlug/jedi

Set stdout and stdin to binary mode on Python 2 and Windows

This commit is contained in:
micbou
2018-06-19 23:49:39 +02:00
committed by Dave Halter
parent f9e90e863b
commit 106b11f1af
2 changed files with 23 additions and 37 deletions

View File

@@ -278,6 +278,12 @@ class Listener(object):
if sys.version_info[0] > 2:
stdout = stdout.buffer
stdin = stdin.buffer
# Python 2 opens streams in text mode on Windows. Set stdout and stdin
# to binary mode.
elif sys.platform == 'win32':
import msvcrt
msvcrt.setmode(stdout.fileno(), os.O_BINARY)
msvcrt.setmode(stdin.fileno(), os.O_BINARY)
while True:
try: