Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: TRAPINT doesn't work reliably



On Saturday, September 28, 2019 6:21 PM, Dennis Schwartz <dennis.schwartz@xxxxxxxxxxxxxx> wrote:

> On Saturday, September 28, 2019 2:29 PM, Daniel Shahaf d.s@xxxxxxxxxxxxxxxxxx wrote:
>
> > > > Does removing that assignment make a difference?
> > >
> > > No, the bug triggers for any TRAPINT function I've tried so far.
> >
> > Have you tried an empty function, «TRAPINT () {}»?
> > Is there any reason to also try a «trap ':' INT»?
>
> Both do nothing. It seems like TRAPINT needs to contain at least one
> command or a return statement.

Sorry, I only now realize that `trap ':' INT` actually overcomes the
problem.

I can now set

    trap 'VIMODE="$VIINS"; return 130' INT

and that actually doesn't trigger the bug. Neither does

    mytrap () {
        VIMODE="$VIINS"
        return 130
    }
    trap mytrap INT

but that doesn't change the VIMODE variable on my prompt nor
returns 130. (In both cases, $1 is always empty.)

Cheers,
Dennis



Messages sorted by: Reverse Date, Date, Thread, Author