From 2a6f039663a678d0fcae47318011fbb5d8bb5f1c Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Mon, 29 Jan 2024 13:11:47 -0500 Subject: [PATCH] Message when server-start errors in emacs --daemon Previously, if a user invoked emacs --daemon and then server-start failed, there would be no indication of this and emacs would simply hang. Now, something like emacs --daemon=/nonexistent/sock results in: $ emacs --fg-daemon=/nonexistent/sock Starting Emacs daemon. Creating directory: Permission denied, /nonexistent $ emacs --daemon=/nonexistent/sock Starting Emacs daemon. Creating directory: Permission denied, /nonexistent Error: server did not start correctly and Emacs exits non-zero. * lisp/startup.el (command-line): Catch errors from server-start, and message and exit. (bug#68799) --- lisp/startup.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/startup.el b/lisp/startup.el index 23937055f30..ae465b5bb07 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1627,7 +1627,11 @@ command-line (let ((dn (daemonp))) (when dn (when (stringp dn) (setq server-name dn)) - (server-start) + (condition-case err + (server-start) + (error + (message "%s" (error-message-string err)) + (kill-emacs 1))) (if server-process (daemon-initialized) (if (stringp dn) -- 2.39.3