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

Re: Feature request: ZSH_XTRACEFD variable



On Sun, 2019-07-21 at 17:08 +0200, Timothée Mazzucotelli wrote:
> I'm willing to help implementing this feature (equivalent of Bash's
> BASH_XTRACEFD). Any advice where I should start? Who I should get in touch
> with?

This is the right place.  Certainly feel free to investigate.

Have a look at the way the FILE *xtrerr is handed in the source code.  This
is going to need some more careful management.  Doing this without creating
leaks or crashes on bad file descriptors could be interesting.
In most places, once it is reopened to a different file the redirection
should "just work", but there maybe some interesting special cases
as we do do slightly funny things with xtrerr at some points.

I think you're going to need a special integer variable that manages
this file based on someone setting the FD.  params.c has this sort
of handling --- see various special integer variables with
their own get / set functions, e.g. intsecondssetfn shows you
what happens when someone sets SECONDS. You're going to have
a function of that sort that instead closes and reopens
xtrerr.

I guess ZSH_XTRACEFD is the obvious name.

Cheers
pws



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