emacs-devel
[Top][All Lists]
Advanced

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

Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SI


From: Tassilo Horn
Subject: Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SIGTERM
Date: Wed, 21 Jan 2009 19:49:13 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

Hi Eli,

>> How does emacs handle SIGTERM?  Doesn't it simply run `kill-emacs'?
>
> No.  Fatal signals, such as SIGTERM, are caught by a signal handler,
> which runs emacs.c:shut_down_emacs.  `kill-emacs' in a nutshell runs
> `kill-emacs-hook' and then also calls shut_down_emacs.

Hm, at least if emacs runs as a daemon, I'd say that a simple "killall
emacs" (most probably by some script) is the standard way of stopping
it.  Nobody wants to open a new frame just to shutdown emacs.

>> At least that's what I would expect.
>
> I don't think it's a good idea to run Lisp code from within a fatal
> signal handler.  shut_down_emacs saves all unsaved buffers and cleans
> up the terminal, but doesn't do anything else, because Emacs's
> internal data structures can be very unstable at this point.

So what's the right way to shutdown emacs running as a daemon
noninteractively?

  emacsclient --eval '(kill-emacs)'

queries for user input and waits till one connects and answers.

Bye,
Tassilo




reply via email to

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