possible bug?

Jeff Epler jepler at unpythonic.net
Tue Mar 22 11:35:17 EST 2005


On Tue, Mar 22, 2005 at 07:16:11AM -0700, Earl Eiland wrote:
> I've been having trouble with a program hanging when using the
> subprocess modules "wait()" method.  Replacing it with with a loop that
> used "poll()" solved the problem.

Please include an example, and more information about what platforn you're using
This simple program worked fine for me on Linux with Python 2.4:
#------------------------------------------------------------------------
import subprocess, time

s = subprocess.Popen(['sleep', '2'])
while 1:
    time.sleep(.1)
    if s.poll() is not None: break
print "polling wait done", s.returncode

s = subprocess.Popen(['sleep', '2'])
s.wait()
print "blocking wait done", s.returncode
#------------------------------------------------------------------------

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050322/a26d4cc8/attachment.sig>


More information about the Python-list mailing list