为什么优雅地关闭 emacs 守护进程很重要?
Why is it important to shutdown emacs daemon gracefully?
here and here,他们讨论了如何优雅地关闭 emacs 守护程序。它为什么如此重要?其中一个答案建议使用 pkill -TERM emacs,它可以完成这项工作,但显然不够优雅。没有正常关闭 emacs 守护进程有什么问题?如果我不这样做会发生什么?
谢谢
One of the answers suggested pkill -TERM emacs
, which does the job but apparently not gracefully.
尽管我会推荐使用进程 ID 而不是 pkill
,应该 是一个正常的关闭.手册说:
The ‘kill-emacs’ function is normally called via the higher-level
command ‘C-x C-c’ (‘save-buffers-kill-terminal’). *Note
(emacs)Exiting::. It is also called automatically if Emacs receives a
‘SIGTERM’ or ‘SIGHUP’ operating system signal (e.g., when the
controlling terminal is disconnected), or if it receives a ‘SIGINT’
signal while running in batch mode (*note Batch Mode::).
此行为是在 Emacs 24.1 中引入的(post-日期是您链接到的问答)。
** Exiting changes
*** Emacs now calls `kill-emacs' if it receives SIGTERM or SIGHUP,
or if it receives a SIGINT signal in batch mode.
*** `kill-emacs-hook' is now also run in batch mode.
Third-party code which adds to `kill-emacs-hook' should check if they
do the right thing in batch mode.
至于为什么您不希望非正常关机,这并不是 Emacs 的真正问题。杀死进程而不让它们有任何清理的机会应该永远是最后的手段。不难想象,如果一个进程在写文件的过程中被杀掉了,会出现什么问题。
here and here,他们讨论了如何优雅地关闭 emacs 守护程序。它为什么如此重要?其中一个答案建议使用 pkill -TERM emacs,它可以完成这项工作,但显然不够优雅。没有正常关闭 emacs 守护进程有什么问题?如果我不这样做会发生什么?
谢谢
One of the answers suggested
pkill -TERM emacs
, which does the job but apparently not gracefully.
尽管我会推荐使用进程 ID 而不是 pkill
,应该 是一个正常的关闭.手册说:
The ‘kill-emacs’ function is normally called via the higher-level command ‘C-x C-c’ (‘save-buffers-kill-terminal’). *Note (emacs)Exiting::. It is also called automatically if Emacs receives a ‘SIGTERM’ or ‘SIGHUP’ operating system signal (e.g., when the controlling terminal is disconnected), or if it receives a ‘SIGINT’ signal while running in batch mode (*note Batch Mode::).
此行为是在 Emacs 24.1 中引入的(post-日期是您链接到的问答)。
** Exiting changes
*** Emacs now calls `kill-emacs' if it receives SIGTERM or SIGHUP, or if it receives a SIGINT signal in batch mode.
*** `kill-emacs-hook' is now also run in batch mode. Third-party code which adds to `kill-emacs-hook' should check if they do the right thing in batch mode.
至于为什么您不希望非正常关机,这并不是 Emacs 的真正问题。杀死进程而不让它们有任何清理的机会应该永远是最后的手段。不难想象,如果一个进程在写文件的过程中被杀掉了,会出现什么问题。