yarn berry
: Monitoring stdout
output inside a wrapScriptExecution
hook.
#5376
Unanswered
mm-zacharydavison
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have some tooling that monitors script output in order to collect some analytics.
In
npm
based environments, we used to do this by shimming the script shell using thescript-shell
parameter of.npmrc
, but this has been removed inyarn berry
.It seems like
wrapScriptExecution
could fulfill the same purpose, but the part that we can't quite figure out is how we can hook into thestdout
of the subprocess thats spawned to run the script.Just waiting for the script to return isn't an option, because we do this for indeterminate scripts (e.g. like running a local node.js webserver).
I noticed that the output of the script is actually written to a
logFile
here, which we could use to monitor output, except it's difficult to get a handle on the filename at runtime, since it's a temporary file.I notice that
wrapScriptExecution
hooks do getstdout
andstderr
streams passed to them inextra
, but these areWritable
streams, and thestdout
output isn't piped through to them.How can we do this using
wrapScriptExecution
?Beta Was this translation helpful? Give feedback.
All reactions