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

Re: local_traps doesn't restore traps set from functions



Peter Stephenson wrote on Sat, 09 May 2020 16:24 +0100:
> > On 07 May 2020 at 22:21 Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > Roman Perepelitsa wrote on Wed, 06 May 2020 15:31 +0200:  
> > > It appears that local_traps doesn't restore traps that were originally
> > > set from functions.  
> > 
> > Precisely.
> > 
> > The following patch fixes it:  
> 
> OK, so the point here is that in this case the trap we're fiddling with
> is not going out of scope, nor having something else restored over it,
> it just happens to have been created inside a function.  At this
> point, that fact becomes irrelevant, so we simply massage the information
> to make it behave as if it had been created at the current (new) function
> depth.
> 
> That seems fine --- my only comment would be it would probably be sensible
> to insert some edited version of the previous paragraph as I for one
> am almost certain to wonder what's going on if I encounter this code
> in the future.

Will do.  Thanks for the review!

Daniel



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