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


Groups > gnu.bash.bug > #15806

Re: trap: interactive bash exits on resending SIGINT twice

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: trap: interactive bash exits on resending SIGINT twice
Date 2020-01-15 15:12 -0500
Message-ID <mailman.2647.1579119149.1979.bug-bash@gnu.org> (permalink)
References <9e22237a-78bf-c0bf-efcf-7f536cbed5ea@inlv.org> <ce14f978-21b9-3c8d-0845-4f0994617d0f@case.edu>

Show all headers | View raw


On 1/14/20 11:24 AM, Martijn Dekker wrote:
> Setting the following trap makes an interactive bash (any version) exit on 
> issuing SIGINT:
> 
> trap 'trap "true" INT; kill -s INT $$; trap - INT; kill -s INT $$' INT
> #     ^^^^^^^^^^^^^^^ eat signal       ^^^^^^^^^^ unset trap
> 
> After setting that trap, pressing Ctrl+C, or otherwise causing SIGINT to be 
> sent, causes an interactive bash to exit.

Thanks for the report.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

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


Thread

Re: trap: interactive bash exits on resending SIGINT twice Chet Ramey <chet.ramey@case.edu> - 2020-01-15 15:12 -0500

csiph-web