bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17036: Continuation for Emacs: invoking a process on exit?


From: Eli Zaretskii
Subject: bug#17036: Continuation for Emacs: invoking a process on exit?
Date: Thu, 20 Mar 2014 19:43:31 +0200

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]