unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Weird behavior of kill-emacs
@ 2015-02-18 18:58 Philipp Stephani
  2015-02-18 19:18 ` Eli Zaretskii
  2015-02-18 19:25 ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Philipp Stephani @ 2015-02-18 18:58 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-02-18 21:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-18 18:58 Weird behavior of kill-emacs Philipp Stephani
2015-02-18 19:18 ` Eli Zaretskii
2015-02-18 20:07   ` Andreas Politz
2015-02-18 20:49     ` Philipp Stephani
2015-02-18 20:44   ` Philipp Stephani
2015-02-18 21:02   ` Andreas Politz
2015-02-18 19:25 ` Eli Zaretskii
2015-02-18 21:04   ` Philipp Stephani
2015-02-18 21:17     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).