Delete the emacs-server directory upon Emacs exit

* lisp/server.el (server-start): Delete the server directory upon
Emacs exit (bug#44644).  This fixes the problem of /tmp/emacs0
directories being left behind when running an Emacs server as root.
This commit is contained in:
Lars Ingebrigtsen 2020-11-24 06:41:03 +01:00
parent 33e2515257
commit 3802f9ce3d

View file

@ -648,7 +648,12 @@ the `server-process' variable."
;; Remove any leftover socket or authentication file.
(ignore-errors
(let (delete-by-moving-to-trash)
(delete-file server-file)))
(delete-file server-file)
;; Also delete the directory that the server file was
;; created in. There may be other servers running,
;; too, so this may fail.
(ignore-errors
(delete-directory (file-name-directory server-file)))))
(setq server-mode nil) ;; already set by the minor mode code
(display-warning
'server