Closed pvdlg closed 6 years ago
Seems like a good option to have. What is your use-case?
It is a little bit weird that hookStd.stdout({streams: [process.stderr]})
would be allowed. Should we maybe contain the option to the main hookStd()
? Or do you have a use-case I'm not seeing?
I guess when using hookStd.stdout
and hookStd.stderr
the streams
option will be ignored.
The use case is to use a transform function to replace sensitive text from the console output. I also want the user to be able to customize the stdout
and stderr
used by the library and ultimately pass them to signale.
I guess when using hookStd.stdout and hookStd.stderr the streams option will be ignored.
👍
Alright. PR welcome :)
Here is the PR: #19
This would add the option
streams
that would accept an Array of Writable streams. By default if would be:[process.stdout, process.stderr]
when callinghookStd([options], transform)
[process.stdout]
when callinghookStd.stdout([options], transform)
[process.stderr]
when callinghookStd.stderr([options], transform)
The library would then do the same usual, but would get the stream to hook into fro m the new option rather than from
process
.