help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird behavior of kill-emacs


From: Philipp Stephani
Subject: Weird behavior of kill-emacs
Date: Wed, 18 Feb 2015 18:58:13 +0000

Hi,

kill-emacs contains the following code (
http://git.savannah.gnu.org/cgit/emacs.git/tree/src/emacs.c#n1899):

if (feof (stdin))
  arg = Qt;

According to git blame this was introduced in commit f927c5aed, the first
revision.
I suspect this code is responsible for the following somewhat surprising
behavior:

$ emacs -Q -batch -eval '(kill-emacs 37)' < /dev/null ; echo $?
37

$ emacs -Q -batch -eval '(progn (read) (kill-emacs 37))' < /dev/null ; echo
$?
Lisp expression: Error reading from stdin
0

So Emacs silently succeeds if it hit EOF of stdin, no matter what the exit
code passed to kill-emacs was!
This can be a problem for batch jobs that use kill-emacs, e.g.
ert-run-tests-batch-and-exit. Is this working as intended? If so, what's
the reason? Is there a way to work around this behavior?

Thanks,
Philipp


reply via email to

[Prev in Thread] Current Thread [Next in Thread]