[Tutor] question regarding subprocess.Popen

Yi Qiang yi at yiqiang.net
Wed May 10 01:45:58 CEST 2006


Hi list,
I am launching another python program in my python daemon like this:

     pobj = subprocess.Popen(tlsmd,
                             stdin = subprocess.PIPE,
                             stdout = subprocess.PIPE,
                             stderr = subprocess.STDOUT,
                             close_fds = True,
                             bufsize = 0)

I want to detect when the process has exited abnormally (or when I 
ctrl+c it)so I thought I could use pobj.returncode.  However after 
fiddling with it for a while my KeyboardInterrupt does not seem to be 
sent to pobj (i tried re-raising a KeyboardInterrupt there as well) nor 
did testing for pobj.returncode yield any results.
Any ideas?

Thanks


More information about the Tutor mailing list