Re: subprocess leaves child living

2007-06-07 Thread Thomas Dybdahl Ahle
Den Thu, 07 Jun 2007 07:00:53 + skrev reed: > On Jun 5, 7:58 am, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: >> Hi, When I do a small program like >> >> from subprocess import Popen >> popen = Popen(["ping", "google.com"]) from time import sleep >> sleep(100) >> >> start it and kill it, the

Re: subprocess leaves child living

2007-06-07 Thread reed
On Jun 5, 7:58 am, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > Hi, When I do a small program like > > from subprocess import Popen > popen = Popen(["ping", "google.com"]) > from time import sleep > sleep(100) > > start it and kill it, the ping process lives on. > Is there a way to ensure that

Re: subprocess leaves child living

2007-06-06 Thread Michael Bentley
On Jun 6, 2007, at 7:11 AM, Thomas Dybdahl Ahle wrote: > Den Tue, 05 Jun 2007 17:41:47 -0500 skrev Michael Bentley: > >> On Jun 5, 2007, at 5:13 PM, Michael Bentley wrote: >> >> >>> On Jun 5, 2007, at 4:17 PM, Thomas Dybdahl Ahle wrote: >>> Den Tue, 05 Jun 2007 15:46:39 -0500 skrev Michael B

Re: subprocess leaves child living

2007-06-06 Thread Thomas Dybdahl Ahle
Den Tue, 05 Jun 2007 17:41:47 -0500 skrev Michael Bentley: > On Jun 5, 2007, at 5:13 PM, Michael Bentley wrote: > > >> On Jun 5, 2007, at 4:17 PM, Thomas Dybdahl Ahle wrote: >> >>> Den Tue, 05 Jun 2007 15:46:39 -0500 skrev Michael Bentley: >>> But actually *that* is an orphan process. When

Re: subprocess leaves child living

2007-06-05 Thread Nick Craig-Wood
Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > But you can't ever catch sigkill. > Isn't there a way to make sure the os kills the childprocess when the > parrent dies? Not as far as I know. If you've got a pipe open to the child then killing the parent should deliver SIGPIPE to the child w

Re: subprocess leaves child living

2007-06-05 Thread Michael Bentley
On Jun 5, 2007, at 5:13 PM, Michael Bentley wrote: > > On Jun 5, 2007, at 4:17 PM, Thomas Dybdahl Ahle wrote: > >> Den Tue, 05 Jun 2007 15:46:39 -0500 skrev Michael Bentley: >> >>> But actually *that* is an orphan process. When a parent process >>> dies >>> and the child continues to run, the

Re: subprocess leaves child living

2007-06-05 Thread Michael Bentley
On Jun 5, 2007, at 4:17 PM, Thomas Dybdahl Ahle wrote: > Den Tue, 05 Jun 2007 15:46:39 -0500 skrev Michael Bentley: > >> But actually *that* is an orphan process. When a parent process dies >> and the child continues to run, the child becomes an orphan and is >> adopted by init. Orphan processe

Re: subprocess leaves child living

2007-06-05 Thread Thomas Dybdahl Ahle
Den Tue, 05 Jun 2007 15:46:39 -0500 skrev Michael Bentley: > But actually *that* is an orphan process. When a parent process dies > and the child continues to run, the child becomes an orphan and is > adopted by init. Orphan processes can be cleaned up on most Unices with > 'init q' (or somethin

Re: subprocess leaves child living

2007-06-05 Thread Thomas Dybdahl Ahle
Den Tue, 05 Jun 2007 22:01:44 +0200 skrev Rob Wolfe: > Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes: > >> But you can't ever catch sigkill. > > There is no protection against sigkill. > >> Isn't there a way to make sure the os kills the childprocess when the >> parrent dies? > > If the paren

Re: subprocess leaves child living

2007-06-05 Thread Michael Bentley
On Jun 5, 2007, at 3:01 PM, Rob Wolfe wrote: > Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes: > >> But you can't ever catch sigkill. > > There is no protection against sigkill. > >> Isn't there a way to make sure the os kills the childprocess when the >> parrent dies? > > If the parent dies sudd

Re: subprocess leaves child living

2007-06-05 Thread Rob Wolfe
Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes: > But you can't ever catch sigkill. There is no protection against sigkill. > Isn't there a way to make sure the os kills the childprocess when the > parrent dies? If the parent dies suddenly without any notification childprocesses become zombies

Re: subprocess leaves child living

2007-06-05 Thread Thomas Dybdahl Ahle
Den Tue, 05 Jun 2007 07:06:15 -0700 skrev Rob Wolfe: > Thomas Dybdahl Ahle wrote: > >> Problem is - I can't do that when I get killed. Isn't it possible to >> open processes in such a way like terminals? If I kill the terminal, >> everything open in it will die too. > > On POSIX platform you can

Re: subprocess leaves child living

2007-06-05 Thread Rob Wolfe
Thomas Dybdahl Ahle wrote: > Problem is - I can't do that when I get killed. > Isn't it possible to open processes in such a way like terminals? If I > kill the terminal, everything open in it will die too. On POSIX platform you can use signals and ``os.kill`` function. Fo example: import os,

Re: subprocess leaves child living

2007-06-05 Thread Thomas Dybdahl Ahle
Den Tue, 05 Jun 2007 14:07:44 +0200 skrev Stefan Sonnenberg-Carstens: > Thomas Dybdahl Ahle schrieb: >> Hi, When I do a small program like >> >> from subprocess import Popen >> popen = Popen(["ping", "google.com"]) from time import sleep >> sleep(100) >> >> start it and kill it, the ping process l

Re: subprocess leaves child living

2007-06-05 Thread Stefan Sonnenberg-Carstens
Thomas Dybdahl Ahle schrieb: > Hi, When I do a small program like > > from subprocess import Popen > popen = Popen(["ping", "google.com"]) > from time import sleep > sleep(100) > > start it and kill it, the ping process lives on. > Is there a way to ensure that the ping process is always killed whe

subprocess leaves child living

2007-06-05 Thread Thomas Dybdahl Ahle
Hi, When I do a small program like from subprocess import Popen popen = Popen(["ping", "google.com"]) from time import sleep sleep(100) start it and kill it, the ping process lives on. Is there a way to ensure that the ping process is always killed when the python process is? I can't use atexit,