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


Groups > gnu.bash.bug > #15622 > unrolled thread

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

Started byRobert Elz <kre@munnari.OZ.AU>
First post2019-11-21 14:42 +0700
Last post2019-11-21 14:42 +0700
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromRobert Elz <kre@munnari.OZ.AU>
Date2019-11-21 14:42 +0700
SubjectRe: Fwd: Don't set $?=130 when discarding the current command line (not run yet) with CTRL-C?
Message-ID<mailman.2149.1574322182.13325.bug-bash@gnu.org>
    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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web