[Pythonmac-SIG] Subprocess module hangs with select
Sriram Srinivasan
sriram at malhar.net
Thu Aug 4 01:07:29 CEST 2005
I wonder if anyone has seen this behavior or can explain it to me.
I Popen a process and monitor its stdout using select, as follows.
process = Popen(args,stdin=PIPE, stdout=PIPE, stderr=PIPE)
while True:
if not (process.returncode == None):
print process.returncode
break
ready,_, _ = select.select([process.stdout, process.stderr],
[], [], 5)
if ready:
for fd in ready:
print fd.readline()
Now this works fine, in that it dumps out everything that the program
can print, but when the exec'd program finishes executing, the select
() call just hangs. The timeout on the select has no effect.
Ideas?
Thank you very much.
--Sriram
More information about the Pythonmac-SIG
mailing list