GNU bug report logs - #19897
24.3; Emacs exits with exit code 0 if EOF of stdin has been reached

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Wed, 18 Feb 2015 21:02:02 UTC

Severity: normal

Found in version 24.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 19897-done <at> debbugs.gnu.org
Subject: bug#19897: 24.3; Emacs exits with exit code 0 if EOF of stdin has been reached
Date: Thu, 19 Feb 2015 11:47:25 +0000
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> schrieb am Wed Feb 18 2015 at 10:16:29 PM:

> > From: Philipp Stephani <p.stephani2 <at> gmail.com>
> > Date: Wed, 18 Feb 2015 21:58:42 +0100
> >
> > This has been discussed in
> > https://lists.gnu.org/archive/html/help-gnu-emacs/2015-02/msg00381.html.
> >
> > To reproduce:
> >
> > $ emacs -Q -batch -eval '(error "foo")' < /dev/null ; echo $?
> > foo
> > 255
> >
> > $ emacs -Q -batch -eval '(kill-emacs 37)' < /dev/null ; echo $?
> > 37
> >
> > $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))'
> <<< nil ; echo $?
> > Lisp expression: 37
> >
> > $ emacs -Q -batch -eval '(read)' < /dev/null ; echo $?
> > Lisp expression: Error reading from stdin
> > 0
> >
> > $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))'
> < /dev/null ; echo $?
> > Lisp expression: 0
> >
> > The examples with nonzero exit code are as expected.  The examples with
> > zero exit code are unexpected.  They are caused by the code
> >
> >   if (feof (stdin))
> >     arg = Qt;
> >
> > in Fkill_emacs.  This behavior confuses e.g. unit tests runners that
> > rely on a precise exit code.
> > It is not documented in the documentation for kill-emacs.
>
> Fixed in commit 7932d06 on master branch.
>

Thanks for the speedy fix. Confirming that this fixes my problem.
[Message part 2 (text/html, inline)]

This bug report was last modified 10 years and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.