zsh-workers
 help / Atom feed
* Feature request: ZSH_XTRACEFD variable
@ 2019-05-17 15:08 Timothée Mazzucotelli
  2019-05-18  7:55 ` Stephane Chazelas
  0 siblings, 1 reply; 3+ messages in thread
From: Timothée Mazzucotelli @ 2019-05-17 15:08 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

Similar to Bash (BASH_XTRACEFD), I would like to be able to change the file descriptor to which the XTRACE output is sent.

It would allow me to build a Zsh script that computes code coverage through a unit testing tool like ZUnit (inspired by Bats, for Bash).

Indeed ZUnit captures stdout and stderr, therefore I cannot use the XTRACE output to compute code coverage because it's mixed up with stderr and so captured by ZUnit.

Regards,
Timothée Mazzucotelli

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Feature request: ZSH_XTRACEFD variable
  2019-05-17 15:08 Feature request: ZSH_XTRACEFD variable Timothée Mazzucotelli
@ 2019-05-18  7:55 ` Stephane Chazelas
  2019-05-20 10:34   ` Stephane Chazelas
  0 siblings, 1 reply; 3+ messages in thread
From: Stephane Chazelas @ 2019-05-18  7:55 UTC (permalink / raw)
  To: Timothée Mazzucotelli; +Cc: zsh-workers

2019-05-17 15:08:57 +0000, Timothée Mazzucotelli:
> Similar to Bash (BASH_XTRACEFD), I would like to be able to
> change the file descriptor to which the XTRACE output is sent.
[...]

I second that.

There are several cases where xtrace is not usable without
such a feature, like when a script does var=$(myfunction 2>&1).

env BASH_XTRACEFD=7 7> debug.log SHELLOPTS=xtrace bash some-cmd

Is something I use often for debugging. I sometimes even go all
the trouble of changing /bin/sh to a symlink to bash just for
that.

Being able to use zsh instead (with its much more powerful $PS4
customisation) would be very handy.

The zsh equivalent of bash's SHELLOPTS can be achieved with
~/.zshenv. I'm not suggesting zsh should add a SHELLOPTS
equivalent as it's quite dangerous a feature.

-- 
Stephane

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Feature request: ZSH_XTRACEFD variable
  2019-05-18  7:55 ` Stephane Chazelas
@ 2019-05-20 10:34   ` Stephane Chazelas
  0 siblings, 0 replies; 3+ messages in thread
From: Stephane Chazelas @ 2019-05-20 10:34 UTC (permalink / raw)
  To: Timothée Mazzucotelli, zsh-workers

2019-05-18 08:55:14 +0100, Stephane Chazelas:
> 2019-05-17 15:08:57 +0000, Timothée Mazzucotelli:
> > Similar to Bash (BASH_XTRACEFD), I would like to be able to
> > change the file descriptor to which the XTRACE output is sent.
> [...]
> 
> I second that.
[...]

See also:

https://unix.stackexchange.com/questions/516918/direct-xtrace-output-elsewhere-than-stderr-in-zsh
https://unix.stackexchange.com/questions/813/how-to-determine-where-an-environment-variable-came-from/154971#154971
https://unix.stackexchange.com/questions/367322/which-startup-file-is-being-used-by-my-shell/367353#367353

-- 
Stephane

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-17 15:08 Feature request: ZSH_XTRACEFD variable Timothée Mazzucotelli
2019-05-18  7:55 ` Stephane Chazelas
2019-05-20 10:34   ` Stephane Chazelas

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/ public-inbox