Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15622

Re: Fwd: Don't set $?=130 when discarding the current command line (not run yet) with CTRL-C?

Path csiph.com!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: Fwd: Don't set $?=130 when discarding the current command line (not run yet) with CTRL-C?
Date Thu, 21 Nov 2019 14:42:07 +0700
Lines 21
Approved bug-bash@gnu.org
Message-ID <mailman.2149.1574322182.13325.bug-bash@gnu.org> (permalink)
References <CADv8-oi+7MQ042_cAjtPrr4Jm=EFjjFLHGxSOPpWwF3066uotA@mail.gmail.com> <CADv8-ogKo=wDshxPiJj8D+BydvcOFS99KQ5pDjWCu7a1v=8nwQ@mail.gmail.com> <11624.1574322127@jinx.noi.kre.to>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1574322183 15090 209.51.188.17 (21 Nov 2019 07:43:03 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bash.bug list" <bug-bash@gnu.org>
To Clark Wang <dearvoid@gmail.com>
Envelope-to bug-bash@gnu.org
In-Reply-To <CADv8-oi+7MQ042_cAjtPrr4Jm=EFjjFLHGxSOPpWwF3066uotA@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x [generic]
X-Received-From 2001:3c8:9009:181::2
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <11624.1574322127@jinx.noi.kre.to>
X-Mailman-Original-References <CADv8-oi+7MQ042_cAjtPrr4Jm=EFjjFLHGxSOPpWwF3066uotA@mail.gmail.com> <CADv8-ogKo=wDshxPiJj8D+BydvcOFS99KQ5pDjWCu7a1v=8nwQ@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15622

Show key headers only | View raw


    Date:        Thu, 21 Nov 2019 10:27:08 +0800
    From:        Clark Wang <dearvoid@gmail.com>
    Message-ID:  <CADv8-oi+7MQ042_cAjtPrr4Jm=EFjjFLHGxSOPpWwF3066uotA@mail.gmail.com>

  | So is it OK to not change $? when people are pressing CTRL-C to
  | discard the input?

I would say not only "OK" but "required" - $? should only ever be
changed as a result of command execution (or attempted execution in
case the exec, or redirection, or something, fails).   Even if there's
a SIGINT trap handler that runs commands, $? should not be being
altered merely as a result of a SIGINT, only when that SIGINT causes
a command to abort, in which case that command's exit status (which
will be 128+SIGINT .. typically 130 .. when the SIGINT wasn't caught
by the application) should $? be altered.

Of course, Chet might disagree...

kre

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Fwd: Don't set $?=130 when discarding the current command line (not run yet) with CTRL-C? Robert Elz <kre@munnari.OZ.AU> - 2019-11-21 14:42 +0700

csiph-web