Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16156
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | gentoo_eshoes@tutanota.com |
| Newsgroups | gnu.bash.bug |
| Subject | Re: looking for consistent C-c trap behavior |
| Date | Fri, 17 Apr 2020 22:14:10 +0200 (CEST) |
| Lines | 54 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.540.1587154456.3066.bug-bash@gnu.org> (permalink) |
| References | <M58iOBd--3-2@tutanota.com> <CAOSMAuuow0=Q7dzYyw3DnYduX79+Cqcc1jyb6q3KZK+z3ofzpg@mail.gmail.com> <M58lP4X--3-2@tutanota.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | multipart/mixed; boundary="----=_Part_71342_1741311976.1587154450506" |
| X-Trace | usenet.stanford.edu 1587154457 15567 209.51.188.17 (17 Apr 2020 20:14:17 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash <bug-bash@gnu.org> |
| To | Eduardo Bustamante <dualbus@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1587154450; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=t2CR/X4ok38TRZkHKaKG29hsQWVU8DrdD+oz09C8T0A=; b=XpJY9baQgOMAS74/BZ2kKVDk6ZXjGS/2hCN0QuKN9bZkW2rI7gnu7o3g2yOip45d Fts9Abfu5GmQSBKdLdRhiC0CVvukaCs9mEhbbhXfcDBqzcWzRQcuvZzGRmDcGMuKXxK NV/RD0pIINvdfoYZiIH8Gv1rwUT4kowDG8XlNijudMuluVF+z7Byehmgx737grGaPE6 jnb8aFU2/op4/gkp2vV5FWea4C60Hj0KZ5DxFFG7Plavs6QGPvahuU7PV72cBWjH1cf JgeDFCf6kpitxCwW2m/6SO6KS9TOM7qpFBvboOqM+6f3ZmVaYezQ2U8rT8hbTdUpyb7 25oOSWvwJA== |
| In-Reply-To | <CAOSMAuuow0=Q7dzYyw3DnYduX79+Cqcc1jyb6q3KZK+z3ofzpg@mail.gmail.com> |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] |
| X-Received-From | 81.3.6.162 |
| 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 | <M58lP4X--3-2@tutanota.com> |
| X-Mailman-Original-References | <M58iOBd--3-2@tutanota.com> <CAOSMAuuow0=Q7dzYyw3DnYduX79+Cqcc1jyb6q3KZK+z3ofzpg@mail.gmail.com> |
| Xref | csiph.com gnu.bash.bug:16156 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Apr 17, 2020, 22:02 by dualbus@gmail.com: > On Fri, Apr 17, 2020 at 12:59 PM gentoo_eshoes--- via Bug reports for > the GNU Bourne Again SHell <bug-bash@gnu.org> wrote: > >> >> I've noticed that if I trap SIGINT in a bash script, the behavior when encountering C-c depends on whether an external command (eg. 'sleep 100') or a builtin command (like 'read -p') was encountered. >> >> I attach an example script which requires me to press C-c twice to interrupt the builtin 'read -p' command, and it only works because I'm restoring the trap via 'trap - SIGINT' the first time. >> >> My goal is to have C-c interrupt and use that exit code (130 most likely) to exit with from script, regardless or whether or not the interrupted command in the script was an internal or external one. >> >> How to do? >> > > I recommend reading: https://www.cons.org/cracauer/sigint.html > > The problem is that the signal is sent to the foreground process. When > "sleep" is running, it's the sleep command that receives the signal > and decides what to do with it. Not bash. > ok but sleep is doing great - it's doing what I expect it to do and bash is trapping it just fine, it's the builtin 'read' that's the problem... aww man, I forgot to attach it, no wonder you misunderstood... my apologies
Back to gnu.bash.bug | Previous | Next | Find similar
Re: looking for consistent C-c trap behavior gentoo_eshoes@tutanota.com - 2020-04-17 22:14 +0200
csiph-web