Fallback to reading one-byte-at-a-time on Windows (#22)

select.select does not work on file descriptors on Windows, causing subunit to fail.
This commit is contained in:
Claudiu Belu 2017-03-02 18:29:52 +02:00 committed by Free Ekanayaka
parent d85976aa08
commit 7149380ff9
1 changed files with 5 additions and 0 deletions

View File

@ -309,6 +309,11 @@ class ByteStreamToStreamResult(object):
# annoying).
buffered = [content]
while len(buffered[-1]):
# Note: Windows does not support passing a file descriptor to
# select.select. fallback to one-byte-at-a-time.
if sys.platform == 'win32':
break
try:
self.source.fileno()
except: