From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: & and M-& to run programs asynchronously Date: Tue, 07 Jul 2009 12:02:43 +0200 Message-ID: <4A531D43.4010105@swipnet.se> References: <87hcbkpo0e.fsf@gmail.com> <87zlmfpov5.fsf@jurta.org> <87tz20660j.fsf@yahoo.com> <873a9km3fh.fsf@mail.jurta.org> <87y6rbgez1.fsf@CPU107.opentrends.net> <87hbxy373a.fsf@mail.jurta.org> <87zlbps06o.fsf@mail.jurta.org> <87fxded5wg.fsf@mail.jurta.org> <873a9a266b.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1246960990 19354 80.91.229.12 (7 Jul 2009 10:03:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Jul 2009 10:03:10 +0000 (UTC) Cc: ferkiwi+a@gmail.com, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 07 12:03:03 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MO7Vs-0007FH-BN for ged-emacs-devel@m.gmane.org; Tue, 07 Jul 2009 12:03:00 +0200 Original-Received: from localhost ([127.0.0.1]:38421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MO7Vr-0006Cg-N5 for ged-emacs-devel@m.gmane.org; Tue, 07 Jul 2009 06:02:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MO7Vk-0006Cb-Cu for emacs-devel@gnu.org; Tue, 07 Jul 2009 06:02:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MO7Ve-0006C1-3x for emacs-devel@gnu.org; Tue, 07 Jul 2009 06:02:50 -0400 Original-Received: from [199.232.76.173] (port=59529 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MO7Vd-0006Bt-Tp for emacs-devel@gnu.org; Tue, 07 Jul 2009 06:02:45 -0400 Original-Received: from proxy3.bredband.net ([195.54.101.73]:50536) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MO7Vd-00086n-96 for emacs-devel@gnu.org; Tue, 07 Jul 2009 06:02:45 -0400 Original-Received: from iph2.telenor.se (195.54.127.133) by proxy3.bredband.net (7.3.140.3) id 49F597CD01691526 for emacs-devel@gnu.org; Tue, 7 Jul 2009 12:02:44 +0200 X-SMTPAUTH-B2: X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AheEADO6UkpV4S1uPGdsb2JhbACBUYgdjxkBAQEBN7QNhBIF X-IronPort-AV: E=Sophos;i="4.42,361,1243807200"; d="scan'208";a="26089473" Original-Received: from c-6e2de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.110]) by iph2.telenor.se with ESMTP; 07 Jul 2009 12:02:43 +0200 Original-Received: from [172.20.199.2] (gaffa [172.20.199.2]) by coolsville.localdomain (Postfix) with ESMTP id 352147FA07B; Tue, 7 Jul 2009 12:02:43 +0200 (CEST) User-Agent: Thunderbird 2.0.0.22 (X11/20090608) In-Reply-To: <873a9a266b.fsf@mail.jurta.org> X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:112126 Archived-At: Juri Linkov skrev: >> I don't know if it's worth to open a new thread, but as this one is >> related I'll like to report some problem I've had while testing the >> new "&" command (dired-do-async-shell-command). >> >> If you use it to execute a command that opens a child process then it >> will have no effect at all, the parent process will be finished and no >> program will be executed. You can reproduce this if you execute & >> xdg-open (freedesktop command for opening a file). >> >> dired-do-shell-command does work when you use it to execute xdg-open, >> but it will run the program synchronously. >> >> Would it be possible to fix this so that "&" waits for child processes >> running asynchronously to finish? > > I see that running `M-! xdg-open file &' works correctly on KDE, > but fails on Gnome. Is this an Emacs bug at all? > On my system emacs starts a shell in a subprocess that execs xdg-open. xdg-open starts gnome-open in a subprocess and waits for it to finish. I presume KDE starts kde-open instead. gnome-open then starts the real program without waiting for it to finish. I can see that gnome-open does not close the tty before execing the real program, so when the tty goes away (i.e. gnome-open finishes) a SIGHUP is sent. That means the program dies. kde-open on the other hand does close the controlling tty. One way to fix this in Emacs would be to keep the tty around as long as there are processes that has it open (like ssh does). But IMHO this is a bug in gnome-open. Jan D.