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

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

bug#19897: 24.3; Emacs exits with exit code 0 if EOF of stdin has been r


From: Eli Zaretskii
Subject: 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 <address@hidden>
> 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.





reply via email to

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