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!proxad.net!feeder1-2.proxad.net!newsfeed1.ip.tiscali.net!tiscali!transit1.news.tiscali.nl!transit.news.xs4all.nl!newsgate.cistron.nl!xs4all!transit1.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path: <stefan.sonnenb...@pythonmeister.com>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@bag.python.org
X-Spam-Status: OK 0.038
Date: Tue, 05 Jun 2007 14:07:44 +0200
From: Stefan Sonnenberg-Carstens <stefan.sonnenb...@pythonmeister.com>
User-Agent: Thunderbird 2.0.0.0 (Windows/20070326)
MIME-Version: 1.0
To: Thomas Dybdahl Ahle <lob...@gmail.com>
Subject: Re: subprocess leaves child living
References: <pan.2007.06.05.11.59.09@gmail.com>
In-Reply-To: <pan.2007.06.05.11.59.09@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-bounce-key: webpack.hosteurope.de; stefan.sonnenb...@pythonmeister.com;
	1181045268; f4ca3f1e; 
Cc: python-l...@python.org
X-BeenThere: python-l...@python.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: General discussion list for the Python programming language
	<python-list.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/listinfo/python-list>,
	<mailto:python-list-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list>
List-Post: <mailto:python-l...@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
	<mailto:python-list-requ...@python.org?subject=subscribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.8717.1181045270.32031.python-list@python.org>
Lines: 19
NNTP-Posting-Host: 194.109.207.14
X-Trace: 1181045270 news.xs4all.nl 326 [::ffff:194.109.207.14]:38979
X-Complaints-To: abuse@xs4all.nl

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.

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