Replacing unbuffered 'os.fdopen' by proxy object to have a unbuffered stdout solution for Windows and AppVeyor that works on Python 3

This commit is contained in:
Yannick Jadoul
2017-08-17 22:06:23 +02:00
parent 6abacb46e4
commit 92304597bd
2 changed files with 19 additions and 2 deletions
+17
View File
@@ -22,3 +22,20 @@ class BuildSkipper(object):
def __repr__(self):
return 'BuildSkipper(%r)' % ' '.join(self.patterns)
# Taken from https://stackoverflow.com/a/107717
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def writelines(self, datas):
self.stream.writelines(datas)
self.stream.flush()
def __getattr__(self, attr):
return getattr(self.stream, attr)