unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Reuben Thomas <rrt@sc3d.org>
Cc: schwab@linux-m68k.org, 17036@debbugs.gnu.org
Subject: bug#17036: Continuation for Emacs: invoking a process on exit?
Date: Thu, 20 Mar 2014 19:43:31 +0200	[thread overview]
Message-ID: <83txas7ol8.fsf@gnu.org> (raw)
In-Reply-To: <CAOnWdognANysqs2=+QfBMqs09Q09-=Y6GaTRecmpPcJk1WTP4A@mail.gmail.com>

> Date: Thu, 20 Mar 2014 12:02:49 +0000
> From: Reuben Thomas <rrt@sc3d.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Andreas Schwab <schwab@linux-m68k.org>, 
> 	17036@debbugs.gnu.org
> 
> I didn't discuss the command (it was Glenn Morris who suggested the name),
> but in my original bug report I said: "This would be useful for restarting
> having updated my configuration...as it would save having manually to issue a
> new 'emacs' command..." For this, a simple "exec emacs" is enough, but why
> not throw in command-line arguments too.

I'm probably missing something, because I don't see how "exec emacs"
will do what you want.  See below.

> >  I very much doubt that this limitation would not render the whole
> > issue moot on Windows.  E.g., how will restart-emacs then be different
> > from a simple call-process?
> 
> Because Emacs does not continue running after it exits. As I said in my
> second email to this bug: "...to reexec Emacs, it needs to be a proper exec
> [so that] Emacs has[...] finished shutting down when it runs."
> 
> If you simply use CallProcess (or fork/exec on POSIX systems), then the
> newly-started emacs will be in contention with the old one, even if the old
> one has nearly finished exiting.

What do you mean by "in contention"?  What contention do you envision?

> A tail-call, but for processes.

But AFAIU, 'exec' is not a tail-call.  It doesn't shut down the
invoking process; in particular, the atexit and on_exit handlers are
not run.  Depending on where you invoke it in Emacs, even the
kill-emacs-hook might not run.  Therefore, you cannot control whether
everything you get in an orderly shutdown, which you will then need
for the restart, will be in order.

There are also all kinds of small details, like the lock files left
behind by the original process -- the PID remains the same after
'exec', AFAIK.  Etc.

IOW, I'm not entirely sure 'exec' will do what you want.





  reply	other threads:[~2014-03-20 17:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 22:47 bug#17036: Continuation for Emacs: invoking a process on exit? Reuben Thomas
2014-03-18 22:52 ` Andreas Schwab
2014-03-18 22:56   ` Reuben Thomas
2014-03-19  6:27     ` Glenn Morris
2014-03-19 13:10       ` Stefan
2014-03-19 13:19         ` Reuben Thomas
2014-03-19 16:51           ` Eli Zaretskii
2014-03-19 21:14             ` Reuben Thomas
2014-03-20  3:45               ` Eli Zaretskii
2014-03-20 12:02                 ` Reuben Thomas
2014-03-20 17:43                   ` Eli Zaretskii [this message]
2014-03-20 23:10                     ` Reuben Thomas
2014-03-21  7:53                       ` Eli Zaretskii
2014-03-21 10:09                         ` Reuben Thomas
2014-03-21 10:18                           ` Reuben Thomas
2014-03-21 10:18                           ` Eli Zaretskii
2014-03-21 10:25                             ` Reuben Thomas
2022-04-17 11:38       ` Lars Ingebrigtsen
2022-04-17 11:56         ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-17 11:57         ` Eli Zaretskii
2022-04-17 12:08           ` Lars Ingebrigtsen
2022-04-17 12:34             ` Eli Zaretskii
2022-04-17 12:41               ` Eli Zaretskii
2022-04-17 12:52                 ` Lars Ingebrigtsen
2022-04-17 12:49               ` Lars Ingebrigtsen
2022-04-17 14:37                 ` Eli Zaretskii
2022-04-17 14:49                   ` Lars Ingebrigtsen
2022-04-17 15:51                     ` Eli Zaretskii
2022-04-18  8:48                       ` Lars Ingebrigtsen
2022-04-18  9:28                         ` Eli Zaretskii
2022-04-17 14:29               ` Eli Zaretskii
2022-04-17 15:58                 ` Eli Zaretskii
2022-04-17 16:02                   ` Lars Ingebrigtsen
2022-04-17 17:49                     ` Eli Zaretskii
2022-04-18  8:53                       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83txas7ol8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17036@debbugs.gnu.org \
    --cc=rrt@sc3d.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).