Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.093 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; "(i'd": 0.09; '"normal"': 0.16; 'adam': 0.16; 'header:X-Face:1': 0.16; 'received:lan': 0.16; 'seconds,': 0.16; 'socket.': 0.16; 'subprocess,': 0.16; 'cc:addr :python-list': 0.16; 'say,': 0.19; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'trying': 0.21; 'mechanism': 0.21; 'header:In- Reply-To:1': 0.22; 'figure': 0.23; 'cc:2**0': 0.24; "i'm": 0.26; 'process,': 0.28; 'sound': 0.28; 'cc:addr:python.org': 0.29; 'url:library': 0.31; 'tue,': 0.32; 'something': 0.35; 'external': 0.35; 'url:python': 0.36; 'subject:with': 0.36; 'another': 0.37; 'using': 0.38; 'url:docs': 0.39; 'talk': 0.39; 'url:org': 0.39; 'should': 0.39; 'why': 0.39; 'more': 0.61; 'stop': 0.63; 'received:89': 0.64; '2012': 0.67; 'realized': 0.73; '-0800': 0.84; 'conservative': 0.84; 'either,': 0.84; 'place?': 0.84; 'plays': 0.91; 'to:none': 0.93 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on jeftof X-Spam-Level: X-Spam-Status: No, score=0.2 required=7.0 tests=ALL_TRUSTED,MISSING_HEADERS autolearn=no version=3.3.1 Date: Tue, 3 Jan 2012 16:09:36 +0100 From: =?UTF-8?B?SsOpcsO0bWU=?= Cc: python-list@python.org Subject: Re: Avoid race condition with Popen.send_signal In-Reply-To: <8614ceb1-f31f-4904-b2b9-6ef0d2bc7cdc@m20g2000vbf.googlegroups.com> References: <63817f2b-ccf8-4d7d-92a6-c1d622986d8a@j10g2000vbe.googlegroups.com> <8614ceb1-f31f-4904-b2b9-6ef0d2bc7cdc@m20g2000vbf.googlegroups.com> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.8; x86_64-pc-linux-gnu) X-Face: "kBB1-!wF@,"j_&tJ&7; T,t)PeQkZg5?.:{p,s>/,+?b6pN5!yxZy^nRXA=*?W+|J9OG!W[rdx^VA^Sx`R"g,; +MzhAq"tZFg27W4qX+ZXvLX=%piZ6c.7@oSDHyQ0Mff#HGx<{ Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325603216 news.xs4all.nl 6928 [2001:888:2000:d::a6]:33679 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18412 Tue, 3 Jan 2012 06:12:59 -0800 (PST) Adam Skutt a =C3=A9crit: > The conservative approach is to use another IPC mechanism to talk to > the process, such as a pipe or a socket. Why are you trying to send > the child process SIGINT in the first place? Say, you've got an application that plays a sound for a few seconds, using = an external program for that (beep, sox). If you close the application, you wa= nt the sound to stop as well. I don't know much about subprocess, not much more than what is in the tutorial : http://docs.python.org/library/subprocess.html (I don't know much about signalling either, I'm learning...) I naively thought kill() was the "normal" way. Then realized terminate() or even send_signal(SIGINT) would be softer. What would be a good approach, then ? Should I try something like this ? communicate(input=3D"Ctrl+C") (I'd need to figure out how to write Ctrl+C...) Would that be cross-platform ? --=20 J=C3=A9r=C3=B4me