Skip to content
Snippets Groups Projects
Commit 28ce13d1 authored by Bob Lantz's avatar Bob Lantz
Browse files

Fix polling in errRun

It's tricky to get this right, but basically we want to read
if there is something to read; if not, we want to check for
EOF.
parent ef59cd88
No related branches found
No related tags found
No related merge requests found
...@@ -91,19 +91,27 @@ def errRun( *cmd, **kwargs ): ...@@ -91,19 +91,27 @@ def errRun( *cmd, **kwargs ):
errDone = False errDone = False
while not outDone or not errDone: while not outDone or not errDone:
readable = poller.poll() readable = poller.poll()
for fd, _event in readable: for fd, event in readable:
f = fdtofile[ fd ] f = fdtofile[ fd ]
data = f.read( 1024 ) if event & POLLIN:
if echo: data = f.read( 1024 )
output( data ) if echo:
if f == popen.stdout: output( data )
out += data if f == popen.stdout:
if data == '': out += data
if data == '':
outDone = True
elif f == popen.stderr:
err += data
if data == '':
errDone = True
elif event & POLLHUP:
if f == popen.stdout:
outDone = True outDone = True
elif f == popen.stderr: elif f == popen.stderr:
err += data
if data == '':
errDone = True errDone = True
poller.unregister( fd )
returncode = popen.wait() returncode = popen.wait()
return out, err, returncode return out, err, returncode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment