Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion subprocess leaves child living

View parsed - Show only message text

Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed.freenet.de!feeder.news-service.com!post.news-service.com!news.jay.net!not-for-mail
From: Thomas Dybdahl Ahle <lob...@gmail.com>
Subject: Re: subprocess leaves child living
Newsgroups: comp.lang.python
References: <pan.2007.06.05.11.59.09@gmail.com>
 	<mailman.8717.1181045270.32031.python-list@python.org>
User-Agent: Pan/0.129 (Benson & Hedges Moscow Gold)
Message-ID: <pan.2007.06.05.13.16.05@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@jay.net
Organization: Jay.net
Date: Tue, 05 Jun 2007 15:15:42 +0200
Lines: 24
NNTP-Posting-Host: 86.48.47.76 (86.48.47.76)
NNTP-Posting-Date: Tue, 05 Jun 2007 15:15:42 +0200
X-Trace: bd8bd466561fef3958ae929125

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 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, as ping then isn't killed when python is killed "in
>> the hard way"
>>   
> Calling popen.close() perhaps ?
> You basically open a pipe, which spawns a shell and the command is then
> started in there.
> So, if your program quits, the spawned shell is still alive, only the
> pipe is dead.

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.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google