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


Message #10 received at 19897-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 19897-done <at> debbugs.gnu.org
Subject: Re: bug#19897: 24.3;
 Emacs exits with exit code 0 if EOF of stdin has been reached
Date: Wed, 18 Feb 2015 23:16:40 +0200
> 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.




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.