From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reuben Thomas Newsgroups: gmane.emacs.bugs Subject: bug#17036: Continuation for Emacs: invoking a process on exit? Date: Fri, 21 Mar 2014 10:18:30 +0000 Message-ID: References: <874n2v9l10.fsf@igel.home> <8361na9lom.fsf@gnu.org> <83r45x8re9.fsf@gnu.org> <83txas7ol8.fsf@gnu.org> <8361n86l8i.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c1f53c13639504f51b350f X-Trace: ger.gmane.org 1395397638 31455 80.91.229.3 (21 Mar 2014 10:27:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2014 10:27:18 +0000 (UTC) Cc: Andreas Schwab , 17036@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 21 11:27:27 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WQwfe-0006Tt-OQ for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Mar 2014 11:27:26 +0100 Original-Received: from localhost ([::1]:51866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwfe-0003Jg-BI for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Mar 2014 06:27:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwXb-0007S5-Fh for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:19:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQwXX-0001Vz-A0 for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:19:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwXX-0001Vv-7Z for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:19:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WQwXX-000280-0K for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:19:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Mar 2014 10:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17036 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17036-submit@debbugs.gnu.org id=B17036.13953971138112 (code B ref 17036); Fri, 21 Mar 2014 10:19:02 +0000 Original-Received: (at 17036) by debbugs.gnu.org; 21 Mar 2014 10:18:33 +0000 Original-Received: from localhost ([127.0.0.1]:42970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQwX2-00026m-M7 for submit@debbugs.gnu.org; Fri, 21 Mar 2014 06:18:33 -0400 Original-Received: from mail-yh0-f45.google.com ([209.85.213.45]:39084) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQwX0-00026e-MW for 17036@debbugs.gnu.org; Fri, 21 Mar 2014 06:18:31 -0400 Original-Received: by mail-yh0-f45.google.com with SMTP id a41so2091884yho.18 for <17036@debbugs.gnu.org>; Fri, 21 Mar 2014 03:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NCeawH1p72D0MEwa5UffldzfiiKHmPpBEowdlNxu7bE=; b=lLeUQCE8uX8Czm88t1knuj8qh+it7Wic7JbRkyJazGcq0xSxl0UXYV5gioXHDZVZQ6 NqNoo93b3VfCdltoIH3nKT7T1ugw5zaoem7Q9GB/gBrayjdxhFcPqNHTpdxux6BnypvF 4WHqt++4jpbK6YJIuvQQOwml+VeIVpNPS17cg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=NCeawH1p72D0MEwa5UffldzfiiKHmPpBEowdlNxu7bE=; b=S4DU0ee00MQ7mbHViDoA8FaKsLoj94a4/WAjdAKe5ppPzTIiKnD3aJlVjQQNJhHDJi PoNiZQJmUhtb1DfI60f6kFUVQJhIKNFj6AufBFB5sRWvJLPIA4eK7hKkFzn/zpYSjfN/ vguGUncWaytGE/wuSJF1kNneApIsz5f6svntzxiosCkKnLlPvyo55F2vIcV0TCGnp4Vk H9i7tgEMwWKnNpqXAh00NZ4cCxQbq2ghaX7sohl/PBeVwPAbyOWAS04Cdc62uIF4lOPf ILCbtIffAXxJxzcdjWGbPmFEsMjrykyl58EuSVnQQkU2NqJSXQwQgf76nAXJ4FLJWgNV tmsg== X-Gm-Message-State: ALoCoQlUGQEAnN8KnAAPbw7K6rt2+///sOFK4sXyULsyezT9eshQmxtP1fRT+/kp6MkPO7rfE7Mv X-Received: by 10.236.32.103 with SMTP id n67mr7276290yha.73.1395397110222; Fri, 21 Mar 2014 03:18:30 -0700 (PDT) Original-Received: by 10.170.137.66 with HTTP; Fri, 21 Mar 2014 03:18:30 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:87095 Archived-At: --001a11c1f53c13639504f51b350f Content-Type: text/plain; charset=ISO-8859-1 On 21 March 2014 10:09, Reuben Thomas wrote: > > On 21 March 2014 07:53, Eli Zaretskii wrote: > >> > Date: Thu, 20 Mar 2014 23:10:19 +0000 >> > From: Reuben Thomas >> > Cc: Stefan Monnier , Andreas Schwab < >> schwab@linux-m68k.org>, >> > 17036@debbugs.gnu.org >> > >> > I'm sorry, I seem to have made a total hash of explaining something >> really >> > simple. In effect, I want kill-emacs-and-exec, which takes a list of >> > arguments, runs kill-emacs, and then execs the argument list. >> >> As long as it does what you want, fine. But please note that this is >> not the same as exiting Emacs and starting a new session, because the >> original Emacs didn't shut down all the way, and the PID is the same. >> > > I think I'm still being unclear, sorry. > > I am assuming that all the regular atexit handlers have already been > called, and that Emacs is really about to exit. (That is what I mean by > saying that kill-emacs has been run.) So, this could be implemented by > ensuring that the first atexit handler to be registered on startup checks a > "kill-emacs-and-exec" flag, and if it is set, does the exec. > Correspondingly, kill-emacs-and-exec would set the flag, store the > arguments in a suitable place, and then tail-call to kill-emacs. > And if there is a problem with keeping the same PID, or with file descriptors still being open, or any other kind of resource that is released on process exit, then by all means have the atexit handler mentioned above fork(). -- http://rrt.sc3d.org --001a11c1f53c13639504f51b350f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 2= 1 March 2014 10:09, Reuben Thomas <rrt@sc3d.org> wrote:

On 21 March 2014 07:53, Eli Zaretskii <eliz@gnu.org&= gt; wrote:
> Date: Thu, 20 Mar 2014 23:10:19 +0000
> From: Reuben Thomas <rrt@sc3d.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Andreas Schwab <schwab@linux-m68k.org>,
> =A0 =A0 =A0
17036@debbugs.gnu.org
>
> I'm sorry, I seem to have made a total hash of explaini= ng something really
> simple. In effect, I want kill-emacs-and-exec, which takes a list of > arguments, runs kill-emacs, and then execs the argument list.

As long as it does what you want, fine. =A0But please note that this = is
not the same as exiting Emacs and starting a new session, because the
original Emacs didn't shut down all the way, and the PID is the same.

I think= I'm still being unclear, sorry.

I am assuming that all the regular atexit handlers have already been call= ed, and that Emacs is really about to exit. (That is what I mean by saying = that kill-emacs has been run.) So, this could be implemented by ensuring th= at the first atexit handler to be registered on startup checks a "kill= -emacs-and-exec" flag, and if it is set, does the exec. Correspondingl= y, kill-emacs-and-exec would set the flag, store the arguments in a suitabl= e place, and then tail-call to kill-emacs.

And if there is = a problem with keeping the same PID, or with file descriptors still being o= pen, or any other kind of resource that is released on process exit, then b= y all means have the atexit handler mentioned above fork().

--
http://rrt.sc3d.org<= /a>
--001a11c1f53c13639504f51b350f--