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 ):
errDone = False
while not outDone or not errDone:
readable = poller.poll()
for fd, _event in readable:
for fd, event in readable:
f = fdtofile[ fd ]
data = f.read( 1024 )
if echo:
output( data )
if f == popen.stdout:
out += data
if data == '':
if event & POLLIN:
data = f.read( 1024 )
if echo:
output( data )
if f == popen.stdout:
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
elif f == popen.stderr:
err += data
if data == '':
elif f == popen.stderr:
errDone = True
poller.unregister( fd )
returncode = popen.wait()
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