Improve util.pmonitor

This commit is contained in:
julian.filter
2020-04-09 17:10:52 +02:00
parent 1704541cc9
commit d5b4aa829b
+2 -2
View File
@@ -451,7 +451,7 @@ def pmonitor(popens, timeoutms=500, readline=True,
fd = popen.stdout.fileno() fd = popen.stdout.fileno()
fdToHost[ fd ] = host fdToHost[ fd ] = host
fdToDecoder[ fd ] = getincrementaldecoder() fdToDecoder[ fd ] = getincrementaldecoder()
poller.register( fd, POLLIN | POLLHUP ) poller.register( fd, POLLIN )
flags = fcntl( fd, F_GETFL ) flags = fcntl( fd, F_GETFL )
fcntl( fd, F_SETFL, flags | O_NONBLOCK ) fcntl( fd, F_SETFL, flags | O_NONBLOCK )
while popens: while popens:
@@ -461,7 +461,7 @@ def pmonitor(popens, timeoutms=500, readline=True,
host = fdToHost[ fd ] host = fdToHost[ fd ]
decoder = fdToDecoder[ fd ] decoder = fdToDecoder[ fd ]
popen = popens[ host ] popen = popens[ host ]
if event & POLLIN or event & POLLHUP: if event & ( POLLIN | POLLHUP ):
while True: while True:
try: try:
f = popen.stdout f = popen.stdout