Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'mrab': 0.04; 'script,': 0.07; 'terminated': 0.07; 'effect.': 0.09; 'suggestion.': 0.09; 'control-c': 0.16; 'russ': 0.16; 'simpler.': 0.16; 'cc:addr :python-list': 0.16; 'mon,': 0.16; 'wrote:': 0.16; 'avoiding': 0.18; 'simpler': 0.18; 'cc:no real name:2**0': 0.20; 'seems': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'thus': 0.23; 'pm,': 0.24; 'aug': 0.24; 'code': 0.25; 'guess': 0.26; 'suggestion': 0.26; 'bit': 0.28; 'exit': 0.29; 'message- id:@mail.gmail.com': 0.29; 'script': 0.29; 'cc:addr:python.org': 0.30; 'outer': 0.30; 'terminate': 0.30; 'thanks': 0.30; 'chris': 0.32; 'it.': 0.33; 'there': 0.33; 'that,': 0.33; 'done': 0.34; 'idea': 0.34; 'rather': 0.35; 'put': 0.37; 'but': 0.37; 'something': 0.37; 'two': 0.37; 'could': 0.38; 'received:google.com': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'ok,': 0.39; 'received:74.125': 0.39; 'huge': 0.61; 'choose': 0.61; 'believe': 0.65; '29,': 0.67; 'august': 0.70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ryNPY7VABpDdcxpTKpYcnHAqxls3dNo1Scf8tLGReEY=; b=sSM9moL6rrPpiguu8GZ5goKCOd0ocKDTvpie3m0YfD9LdHE+zcjd6WpHo0hVSFJH/o 0yeNkyjutGmYhZrjEYbh8O4GXUTlegmYhWLXeU+RPlFQn/YNwMiWw11YvQ0y4NgnADMB KZEUZFZdFkOH4sGhqyPa4HS+81o3XkgxvNtR4= MIME-Version: 1.0 In-Reply-To: References: <22a0dae6-8a60-4e68-82a5-31a949bd69d5@y8g2000prd.googlegroups.com> Date: Mon, 29 Aug 2011 23:53:13 +0100 Subject: Re: killing a script From: Arnaud Delobelle To: "Russ P." Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314658396 news.xs4all.nl 2532 [2001:888:2000:d::a6]:58179 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12424 On 29 August 2011 04:08, Russ P. wrote: > On Aug 28, 7:51=C2=A0pm, Chris Angelico wrote: >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote= : >> > On Aug 28, 6:52=C2=A0pm, MRAB wrote: >> >> You could look at the return value of os.system, which may tell you t= he >> >> exit status of the process. >> >> > Thanks for the suggestion. Yeah, I guess I could do that, but it seems >> > that there should be a simpler way to just kill the "whole enchilada." >> > Hitting Control-C over and over is a bit like whacking moles. >> >> I believe the idea of this suggestion is for the outer script to >> notice that the inner script terminated via Ctrl-C, and would then >> immediately choose to terminate itself - thus avoiding the >> whack-a-mole effect. >> >> ChrisA > > Yes, but if I am not mistaken, that will require me to put a line or > two after each os.system call. That's almost like whack-a-mole at the > code level rather than the Control-C level. OK, not a huge deal for > one script, but I was hoping for something simpler. I was hoping I > could put one line at the top of the script and be done with it. Write a function! That's what they're for after all :) --=20 Arnaud