summaryrefslogtreecommitdiff
path: root/etc/emacs.service
diff options
context:
space:
mode:
authorTim Ruffing <crypto@timruffing.de>2020-12-14 17:59:58 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-12-14 17:59:58 +0100
commite5348f125ff03ac70713e5b227f9e51f759a587b (patch)
treea61426185652c6a7659b88b7a8bf3f5eeb7783e2 /etc/emacs.service
parentb63cb95ad441a47afcf6c7848e6583b89b0e6755 (diff)
downloademacs-e5348f125ff03ac70713e5b227f9e51f759a587b.tar.gz
* etc/emacs.service:
* etc/emacs.service (ExecStart): Make Emacs exit from systemd work better (bug#45181). The problem here is the exit code 15, which emacs will return *only* if it has received SIGTERM. I believe what's happening here is that emacsclient will call kill-emacs but not wait until the emacs server has properly shut down. However, it's supposed to wait for the shutdown as an "ExecStop" command according to "man systemd.service". So since the process is still alive when emacsclient comes back, systemd will still issue SIGTERM, making emacs return 15 (maybe after calling kill- emacs again?!). Copyright-paperwork-exempt: yes
Diffstat (limited to 'etc/emacs.service')
-rw-r--r--etc/emacs.service6
1 files changed, 5 insertions, 1 deletions
diff --git a/etc/emacs.service b/etc/emacs.service
index c99c6779f58..809c49cdbc5 100644
--- a/etc/emacs.service
+++ b/etc/emacs.service
@@ -9,7 +9,11 @@ Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
[Service]
Type=notify
ExecStart=emacs --fg-daemon
-ExecStop=emacsclient --eval "(kill-emacs)"
+
+# Emacs will exit with status 15 after having received SIGTERM, which
+# is the default "KillSignal" value systemd uses to stop services.
+SuccessExitStatus=15
+
# The location of the SSH auth socket varies by distribution, and some
# set it from PAM, so don't override by default.
# Environment=SSH_AUTH_SOCK=%t/keyring/ssh