On 4/18/20 5:41 PM, gentoo_esh...@tutanota.com wrote:

> can confirm that indeed `bash --posix` does interrupt the 'read -p' on first 
> C-c, however, the inside-trap seen exit code is 0, but if the trap doesn't 
> `exit` itself, then the exit code after the 'read -p' is seen correctly as 
> 130, ie.
> $ ./sigintread.bash 
> Press C-c here...^Cinterrupted sees exit code '0'
> 
> Normal exit sees ec=130
> 
> Would it be possible to somehow get 130 even inside the trap function?
> 
> this would then be equivalent with interrupting 'sleep' for example:
> $ ./sigintread.bash 
> ^Cinterrupted sees exit code '130'
> 
> Normal exit sees ec=130

This is a reasonable idea for posix mode, since the trap action is run
after the read command returns.

> On another note, I naively tried to patch out the POSIX requirement, for my 
> own/local_use puposes but had no effect:

This (from bashline.c) is for readline support. The `read -e' comment is
true.


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

    • Re: l... Greg Wooledge
      • R... Eduardo Bustamante
    • Re: l... gentoo_eshoes--- via Bug reports for the GNU Bourne Again SHell
      • R... gentoo_eshoes--- via Bug reports for the GNU Bourne Again SHell
      • R... gentoo_eshoes--- via Bug reports for the GNU Bourne Again SHell
  • Re: lookin... Chet Ramey
    • Re: l... gentoo_eshoes--- via Bug reports for the GNU Bourne Again SHell
      • R... gentoo_eshoes--- via Bug reports for the GNU Bourne Again SHell
        • ... Chet Ramey
          • ... gentoo_eshoes--- via Bug reports for the GNU Bourne Again SHell
      • R... Chet Ramey

Reply via email to