On Nov 5, 5:12 pm, Michele Petrazzo <[EMAIL PROTECTED]> wrote: > Hi all, > I believe that this is a *nix question, but since I'm developing in > python, I'm here. > > I have a code that execute into a "Popen" a command (ssh). I need that, > if the python process die, the parent pid (PPID) of the child don't > become 1 (like I can seen on /proc/$pid$/status ), but it has to die, > following it's parent > It's possible in linux and with subprocess?
AFAIK, there is no easy way to do this. If the parent python process is doing a controlled exit, just kill the child via close() on Popen() handle. If the parent is doing a uncontrolled exit (say via a SIGKILL signal), you can't really do anything. To reliably have the child exit when the parent exits, you would have to poll for the parent from the child and do a exit when the child detects that the parent has gone away. -srp > > Thanks, > Michele -- http://mail.python.org/mailman/listinfo/python-list