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

Re: Feature request: ZSH_XTRACEFD variable



Bart Schaefer wrote on Sat, 02 May 2020 14:15 -0700:
> On Sat, May 2, 2020 at 11:03 AM Timothée Mazzucotelli
> <timothee.mazzucotelli@xxxxxxxxx> wrote:
> >
> > How to make sure the file descriptor of a local ZSH_XTRACEFD is closed when
> > leaving the function scope?
> > Or, how to make sure a local ZSH_XTRACEFD is unset when leaving the
> > function scope?  
> 
> I think you're going to have to declare ZSH_XTRACEFD to be a "special"
> variable, with all the extra plumbing that entails.

It's already special, via the IPDEF5() macro.

The end-of-scope processing happens in scanendscope().  If the
parameter weren't special, unsetparam_pm() would be called and would
call the unsetfn.  However, the codepath for (non-removable) specials
doesn't call the unsetfn; it just calls the setfn again.

I would have expected the unsetfn to be called for any special parameter.

Cheers,

Daniel

P.S. Shouldn't ZSH_XTRACEFD be declared with PM_DONTIMPORT?



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