Make stdout unbuffered
This commit is contained in:
parent
a52e6d968c
commit
c3a11254bb
@ -27,6 +27,7 @@ bufferSize = 8096 # buffer size in bytes
|
||||
timeout = 15 # timeout in seconds
|
||||
connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
unbufferedStdout = os.fdopen(sys.stdout.fileno(),"wb",0) # Make unbuffered stdout
|
||||
|
||||
def listToCommand(lst):
|
||||
cmd = ""
|
||||
@ -95,7 +96,7 @@ def main():
|
||||
while True:
|
||||
data = connection.recv(bufferSize)
|
||||
if data == b"": return
|
||||
sys.stdout.buffer.write(data)
|
||||
unbufferedStdout.write(data)
|
||||
except:
|
||||
connection.close()
|
||||
raise
|
||||
@ -112,4 +113,4 @@ def main():
|
||||
raise
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user