Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15848
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Roger <rogerx.oss@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Protect Loop Execution with Traps |
| Date | Wed, 29 Jan 2020 15:19:07 -0500 |
| Lines | 19 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.63.1580329155.2384.bug-bash@gnu.org> (permalink) |
| References | <20200128212551.GD12574@localhost4.local> <20200128020322.GA31704@localhost4.local> <20200128134935.GM1350@eeg.ccf.org> <20200128204932.GB12574@localhost4.local> <20200128210721.GU1350@eeg.ccf.org> <59.1580277932@jinx.noi.kre.to> <20200129143352.GY1350@eeg.ccf.org> <20200129201907.GA17112@localhost4.local> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | usenet.stanford.edu 1580329156 21362 209.51.188.17 (29 Jan 2020 20:19:16 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=aBPai7yz9WTXcxM/Fwy6Emr14BpvrIYNZl1OmWxJ3PE=; b=NnCtCt624QwSgqEG8AP84Njv9RYW9xqQEJlbosJPHhoUyGsisHJrT/9MBhHKKLPCuB d0r8XguLPYJN8cN5GRQT2MIvdA0bFfvwLXl8F67jdI5Y3T7xrcmzWiSY9E7UHXyWo/6q VvTnk1fEoEfxpwVC15svHC+xmw08Hsh4nS+7F0zKOFv7/D29FLrNPcIZYPeu6kuEG1ws bokDpKustQngDFVlOVrSal2y7m4QNZ7FiMKeJY1lvcfnhK8zRpaMMq+iJOh63iE7D647 nnHvMBEKFa3nAIcjPVy3KpzXFJ5fFaS7pkDBJ+153WHuYCf/D4eBQRewsKgFRTu0I6Aj L/Cg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aBPai7yz9WTXcxM/Fwy6Emr14BpvrIYNZl1OmWxJ3PE=; b=FWcc4NBsWkdd8k8TgvuSXgyJof3YfAZLmwUdTuwjgniisHgwTOt6CDHrMwS7NyH5WZ vh/MHUKMJVcqqM/Uu+1NlbZBuGdojuu/niXSKIBlejPx8DGhYufheLJm6Vf/dj8c0HuA 1YsPB3N6YsrOSqcbLUb3VmzqhhGCKddaEImUGUQPTWr61itLNlaoaoTDFqDG3DazOS3Q zUrMkSH22+cNoZpthR4NF4MuQUXgz3U5ek1uC8YdTowwD1D1YiyvUUp0B8JutAsl9fZt 6YUzaqdYT1IT5/5orYTlgs+s71gIhmXcfHCDvH6pRn0d3QDOnFXWrfwn4Slt1rdw7+tO wPaA== |
| X-Gm-Message-State | APjAAAWqmq+KepYdRZDxaooqRUOG21rYnlADADc8k7waq7JU4AlWUCPu xhNAW1lLU3ZImp8+Qdx9YhoHon4hiO0= |
| X-Google-Smtp-Source | APXvYqxDU/nJiFHFul/mhzwQhL51RMHY/W0MW3QqSub/GEunmYu+WAUgAV2yvvfh8yA6m2XidNtjQw== |
| X-Received | by 2002:a05:620a:1010:: with SMTP id z16mr1568035qkj.237.1580329148621; Wed, 29 Jan 2020 12:19:08 -0800 (PST) |
| Content-Disposition | inline |
| In-Reply-To | <20200129143352.GY1350@eeg.ccf.org> |
| X-PGP-Key | http://rogerx.sdf.org/about/armor-F515AC1F231FFC4EF0BCDE7606CEA0ECE2887C75-20170104.asc |
| User-Agent | Mutt/1.10.1 (2018-07-13) |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2607:f8b0:4864:20::72c |
| 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 | <20200129201907.GA17112@localhost4.local> |
| X-Mailman-Original-References | <20200128212551.GD12574@localhost4.local> <20200128020322.GA31704@localhost4.local> <20200128134935.GM1350@eeg.ccf.org> <20200128204932.GB12574@localhost4.local> <20200128210721.GU1350@eeg.ccf.org> <59.1580277932@jinx.noi.kre.to> <20200129143352.GY1350@eeg.ccf.org> |
| Xref | csiph.com gnu.bash.bug:15848 |
Show key headers only | View raw
>sigint_handler() {
> trap - INT
> kill -INT $$
>}
>trap sigint_handler INT
One thing to note here, I tried inserting the "trap sigint_handler INT" prior
to the loop/for/while statement (or outside of the loop) and the trap doesn't
work as you state it does for yourself.
I find I have to insert "trap sigint_handler INT" within my loop (for/while)
section of code, for the trap to work. In my eyes or for me, this works as
expected.
--
Roger
http://rogerx.sdf.org/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Protect Loop Execution with Traps Roger <rogerx.oss@gmail.com> - 2020-01-29 15:19 -0500
csiph-web