From b540c45bc53d66c3869e049e6577b275c446a87f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Feb 2026 16:10:08 +0200 Subject: [PATCH] Document that string ARG of 'kill-emacs' might not work * src/emacs.c (Fkill_emacs): * doc/lispref/os.texi (Killing Emacs): Document that EXIT-DATA being a string doesn't always work. (Bug#80435) --- doc/lispref/os.texi | 5 ++++- src/emacs.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index ccc0f69a12d..bb768fe2da8 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -713,7 +713,10 @@ the Emacs process. (This is useful primarily in batch operation; see If @var{exit-data} is a string, its contents are stuffed into the terminal input buffer so that the shell (or whatever program next reads -input) can read them. +input) can read them. This is only possible on some systems. Note that +recent versions of GNU/Linux disable the system API required for +stuffing the string into the terminal input, so this might not work on +your system without special privileges. If @var{exit-data} is neither an integer nor a string, or is omitted, that means to use the (system-specific) exit status which indicates diff --git a/src/emacs.c b/src/emacs.c index 17c56986083..777ade9d825 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2947,7 +2947,9 @@ sort_args (int argc, char **argv) DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 2, "P", doc: /* Exit the Emacs job and kill it. If ARG is an integer, return ARG as the exit program code. -If ARG is a string, stuff it as keyboard input. +If ARG is a string, stuff it as keyboard input. (This might +not work on modern systems due to security considerations, or +not at all.) Any other value of ARG, or ARG omitted, means return an exit code that indicates successful program termination.