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: Eli Zaretskii
Subject: Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SIGTERM
Date: Wed, 21 Jan 2009 20:42:58 +0200

> From: Tassilo Horn <address@hidden>
> Date: Wed, 21 Jan 2009 09:06:58 +0100
> 
> 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.

> 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.

> A related question: What does emacs --daemon do when it receives a
> SIGTERM and there are unsaved buffers?

Sorry, I don't know.  Someone else will have to answer this.




reply via email to

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