#Zig build redirect standard out to standard error

1 messages · Page 1 of 1 (latest)

formal oyster
#

I have a system tool used by the zig system, but the output goes to standard out rather than standard error so error messages from the tool do not show in the zig build output. How can I get the output shown?

mental heath
#

One way would be to wrap it's execution in another program (e.g. tee) that pipes stdout to stderr. I expect every shell to have such a capability.

formal oyster
#

yeah, that's one way and I guess I could make a zig program that does that to work universally, but surely there must be a simpler way?

torn sentinel
#

The program first of all breaks convention by not logging human output to stderr.
In shell you can redirect stdout to stderr 1>&2

#

To achieve same in pure zig, youd need to make a program that swaps the fds and then execs the problematic program, but might be easier just to patch the program itself