From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.help
Subject: Weird behavior of kill-emacs
Date: Wed, 18 Feb 2015 18:58:13 +0000
Message-ID:
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1424285920 32760 80.91.229.3 (18 Feb 2015 18:58:40 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 18 Feb 2015 18:58:40 +0000 (UTC)
To: "help-gnu-emacs@gnu.org"
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 18 19:58:34 2015
Return-path:
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
by plane.gmane.org with esmtp (Exim 4.69)
(envelope-from )
id 1YO9pR-0001Yl-I6
for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Feb 2015 19:58:33 +0100
Original-Received: from localhost ([::1]:52277 helo=lists.gnu.org)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from )
id 1YO9pQ-00032P-T6
for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Feb 2015 13:58:32 -0500
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57274)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YO9pF-00032I-1o
for help-gnu-emacs@gnu.org; Wed, 18 Feb 2015 13:58:22 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1YO9pA-0006Ob-6A
for help-gnu-emacs@gnu.org; Wed, 18 Feb 2015 13:58:20 -0500
Original-Received: from mail-lb0-f182.google.com ([209.85.217.182]:44548)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YO9p9-0006O6-VZ
for help-gnu-emacs@gnu.org; Wed, 18 Feb 2015 13:58:16 -0500
Original-Received: by lbiz12 with SMTP id z12so3025404lbi.11
for ; Wed, 18 Feb 2015 10:58:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=mime-version:from:date:message-id:subject:to:content-type;
bh=EGjBLLQreVoRZj/CLIHpDYfrgG7CZNxfQRbYZJu56/A=;
b=rBPlQbPGcTa1orF3Qn3GHnsAtU3BZrE6vNCn45B+Yld4QzqtgaNaU9vcoJA+UNIRwb
ghHIdzpx2o6J1Ar49q9EAB8JbAKmwQIEbv8a4YUjhe75ymXejkERvqR+/738Jz9dp9a1
zOUX5DYRHpwLg5fXrTyIZKV6kp6jgVPyANBT6cM6SjdbLtHQ3EiFEp/8/7kUklhEMwMW
tonkGRaQPgR1v19MekIUrpCbXYIOCr3qBfmikRJx8jY4frCbxtDZOrb+PTEXvjNyWg6B
skKwp6uhro+xFs4F6OBgR/MoSYqH2HcduvRuD6WfuESV046h6Z9deQC5OUzCOxw+6bTX
To5A==
X-Received: by 10.152.36.162 with SMTP id r2mr714194laj.9.1424285894326; Wed,
18 Feb 2015 10:58:14 -0800 (PST)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
[fuzzy]
X-Received-From: 209.85.217.182
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Users list for the GNU Emacs text editor
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.help:102793
Archived-At:
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