unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 19897-done@debbugs.gnu.org
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	[thread overview]
Message-ID: <83twyi539j.fsf@gnu.org> (raw)
In-Reply-To: <wvr4wq3fym0t.fsf@phst2.muc.corp.google.com>

> From: Philipp Stephani <p.stephani2@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.





  reply	other threads:[~2015-02-18 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18 20:58 bug#19897: 24.3; Emacs exits with exit code 0 if EOF of stdin has been reached Philipp Stephani
2015-02-18 21:16 ` Eli Zaretskii [this message]
2015-02-19 11:47   ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83twyi539j.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=19897-done@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

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).