all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.