Allow capturing of stderr as part of custom_target
#12250
mitchgrout
started this conversation in
Ideas
Replies: 1 comment
-
One cleaner solution I suppose could be to instead hoist this into find_program(...,, swap_streams: true) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Certain tools may emit useful information into the
stderr
stream, which we may want to capture as a custom target. Currently we can capturestdout
usingcustom_target(..., capture: true)
, however there doesn't appear to be a way to get at thestderr
. It's relatively trivial to write an external script to manage swapping streams, like given below:In my opinion it would be more appropriate to hoist this behaviour into meson, since we already facilitate capturing of
stdout
. My proposal would be to change the type ofcapture
frombool
tobool | dict[str]
while deprecating thebool
variant. Thedict[str]
variant would be of the formwhere the values in the
dict
would represent which files we will capture the specified stream into. If a stream is not specified as a key, then it is not captured. The default value forcapture
would be an empty dict, meaning neitherstdout
norstderr
are captured by default. As an example, the following statements would be equivalent:However, with the new
dict[str]
variant we would be capable of capturing from tools which emit tostderr
rather thanstdout
, e.g.and would also support capturing both streams simultaneously
This request primarily originates from trying to integrate linting into my project, in which I was using a generated executable to manage swapping the streams (which lead to discovering #12040)
Beta Was this translation helpful? Give feedback.
All reactions