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:25:54 +0000 Message-ID: References: <874n2v9l10.fsf@igel.home> <8361na9lom.fsf@gnu.org> <83r45x8re9.fsf@gnu.org> <83txas7ol8.fsf@gnu.org> <8361n86l8i.fsf@gnu.org> <83lhw36eit.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3010e8638e7e6504f51b4fd6 X-Trace: ger.gmane.org 1395397761 400 80.91.229.3 (21 Mar 2014 10:29:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2014 10:29:21 +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:29:30 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 1WQwhd-0000w7-1k for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Mar 2014 11:29:29 +0100 Original-Received: from localhost ([::1]:51890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwhc-00069x-Ku for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Mar 2014 06:29:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwfK-0002ow-9k for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:27:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQwfG-0003vk-15 for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:27:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwfF-0003va-V0 for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:27:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WQwfF-0002Q6-KF for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:27:01 -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:27:01 +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.13953975639198 (code B ref 17036); Fri, 21 Mar 2014 10:27:01 +0000 Original-Received: (at 17036) by debbugs.gnu.org; 21 Mar 2014 10:26:03 +0000 Original-Received: from localhost ([127.0.0.1]:42986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQweG-0002Nx-4b for submit@debbugs.gnu.org; Fri, 21 Mar 2014 06:26:01 -0400 Original-Received: from mail-yh0-f51.google.com ([209.85.213.51]:35712) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQweA-0002NS-Vu for 17036@debbugs.gnu.org; Fri, 21 Mar 2014 06:25:55 -0400 Original-Received: by mail-yh0-f51.google.com with SMTP id f10so2082554yha.24 for <17036@debbugs.gnu.org>; Fri, 21 Mar 2014 03:25:54 -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=bLd2t8L375lh8a8/JgMd/YlrDW8/wysYQgDIjIUzyRw=; b=oJdMEVvR96xnQsbpOpM38A0iOMyvF6Tn2g3uayKKh+PBRYRb2fczBYkp+NfiYxuDpN NTQ+CZyXsbmnT3DdkHRARFFomQy86wAGozpzsP1yRDSxvRhrd6nRthPnA/TtyZWzGJ7h k6ic0GDyBhiI9rCmEaef+J27xERtVu7Q7YRqU= 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=bLd2t8L375lh8a8/JgMd/YlrDW8/wysYQgDIjIUzyRw=; b=W21u/sdr91qnn0oinMW+2dgSKSkm+q1JNmUbL1eaVMyxejZePVts/tx88MBC1cMLFW z/1woauzb0EEbHvmLzkXxnq+hZ4qIkmkSqrmggAMdYQu13HvanN1IB4nHtCSfBxNbK4Q Qm+TOiEpqHGxm8k+bcRHuUp8K3+xw9jdyjfxwEwlhtOdhpLOZpjG63wul3NbCB7aQHsi 5WECHXNlrJM22FWuIO2r5Da4bKtLEu4M19jvnVRAw6oMDqh03JKdYjXuNqkdU6zx6htT O3+E51mPAvlXilY6XXuCbc1Aoxigf96SDaiVXeRUbX2noEOxQnYtc5s47vx4SsjVgCSM k4yw== X-Gm-Message-State: ALoCoQmVOokLcQiR8aKxVH5c0wB+UADuxnc3HwYe+6dlwWnArp3Dm17SMLUaKVr4qB9hDYwIEDQr X-Received: by 10.236.94.103 with SMTP id m67mr41450108yhf.7.1395397554498; Fri, 21 Mar 2014 03:25:54 -0700 (PDT) Original-Received: by 10.170.137.66 with HTTP; Fri, 21 Mar 2014 03:25:54 -0700 (PDT) In-Reply-To: <83lhw36eit.fsf@gnu.org> 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:87096 Archived-At: --20cf3010e8638e7e6504f51b4fd6 Content-Type: text/plain; charset=ISO-8859-1 On 21 March 2014 10:18, Eli Zaretskii wrote: > > Date: Fri, 21 Mar 2014 10:09:10 +0000 > > From: Reuben Thomas > > Cc: Stefan Monnier , Andreas Schwab < > schwab@linux-m68k.org>, > > 17036@debbugs.gnu.org > > > > > 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. > > Assuming a call to 'exec' is allowed in an atexit handler. (I don't > know if it is.) > The only restrictions I can find are that a) if an atexit handler calls _exit, the remaining handlers are not called; b) if the process is terminated by a signal, the handlers are not called. The only thing you can't do is call exit() or longjmp(). You can even call "atexit" from an atexit handler (the new handler is pushed on the front of the remaining queue). -- http://rrt.sc3d.org --20cf3010e8638e7e6504f51b4fd6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 2= 1 March 2014 10:18, Eli Zaretskii <eliz@gnu.org> wrote:
> Date: Fri, 21 Mar 2014 10:09:10 +0000
> From: Reuben Thomas <rrt@sc3d.org>
> Cc: Stefan Monnier <mon= nier@iro.umontreal.ca>, Andreas Schwab <schwab@linux-m68k.org>,
> =A0 =A0 =A0 17036@debbugs.gnu= .org
>
> > As long as it does what you want, fine. =A0= 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 t= he 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 b= y
> saying that kill-emacs has been run.) So, this could be implemented by=
> ensuring that the first atexit handler to be registered on startup che= cks a
> "kill-emacs-and-exec" flag, and if it is set, does the exec.=

Assuming a call to 'exec' is allowed in an atexit handler. = =A0(I don't
know if it is.)

The only restrictio= ns I can find are that a) if an atexit handler calls _exit, the remaining h= andlers are not called; b) if the process is terminated by a signal, the ha= ndlers are not called. The only thing you can't do is call exit() or lo= ngjmp(). You can even call "atexit" from an atexit handler (the n= ew handler is pushed on the front of the remaining queue).
--20cf3010e8638e7e6504f51b4fd6--