the proposed fix is in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29955#23
The patches discussed are attached
>From 109da684c5124e22505917fe0255ca66f2a6bfc9 Mon Sep 17 00:00:00 2001 From: Glenn Morris <r...@gnu.org> Date: Tue, 23 Jan 2018 20:55:09 -0500 Subject: [PATCH] Avoid kill-emacs-hook errors hanging batch mode * src/emacs.c (Fkill_emacs): Prevent errors from kill-emacs-hook hanging Emacs in batch mode. (Bug#29955) --- src/emacs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/emacs.c b/src/emacs.c index 84cd3ac8c8..8ea61b71fb 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2024,7 +2024,10 @@ all of which are called before Emacs is actually killed. */ /* Fsignal calls emacs_abort () if it sees that waiting_for_input is set. */ waiting_for_input = 0; - run_hook (Qkill_emacs_hook); + if (noninteractive) + safe_run_hooks (Qkill_emacs_hook); + else + run_hook (Qkill_emacs_hook); #ifdef HAVE_X_WINDOWS /* Transfer any clipboards we own to the clipboard manager. */ -- 2.15.1
>From 28718c4449972640c39a7be1b62ccc7f50c6e801 Mon Sep 17 00:00:00 2001 From: Glenn Morris <r...@gnu.org> Date: Fri, 14 Apr 2017 21:18:07 -0400 Subject: [PATCH] Avoid userlock queries hanging forever in batch mode * lisp/userlock.el (ask-user-about-lock) (ask-user-about-supersession-threat): Abort in batch mode. --- lisp/userlock.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/userlock.el b/lisp/userlock.el index fc0d3e30d3..a8eb24bd10 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -61,6 +61,7 @@ in any way you like." (while (null answer) (message "%s locked by %s: (s, q, p, ?)? " short-file short-opponent) + (if noninteractive (error "Cannot resolve lock conflict in batch mode")) (let ((tem (let ((inhibit-quit t) (cursor-in-echo-area t)) (prog1 (downcase (read-char)) @@ -149,6 +150,9 @@ really edit the buffer? (y, n, r or C-h) " (file-name-nondirectory fn))) (choices '(?y ?n ?r ?? ?\C-h)) answer) + (when noninteractive + (message "%s" prompt) + (error "Cannot resolve conflict in batch mode")) (while (null answer) (setq answer (read-char-choice prompt choices)) (cond ((memq answer '(?? ?\C-h)) -- 2.15.1