gpt4 book ai didi

ubuntu - 为什么优雅地关闭 emacs 守护进程很重要?

转载 作者:行者123 更新时间:2023-12-04 18:31:26 24 4
gpt4 key购买 nike

herehere ,他们讨论了如何优雅地关闭 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 中引入的(在您链接到的问答之后)。

** 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 的问题。杀死进程而不让它们有任何清理的机会应该始终是最后的手段。例如,如果一个进程在写入文件的过程中被杀死,不难想象可能导致的问题。

关于ubuntu - 为什么优雅地关闭 emacs 守护进程很重要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61379109/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com