Is your feature request related to a problem? Please describe.
At the moment, if one would like to capture the output of stdout
and stderr
separately, it must be done in parallel. For example:
This will properly capture stdout
and stderr
into a Tuple
.
pipe(
Command.command("ls"),
Command.run,
T.chain((process) =>
T.zipPar_(
ProcessStream.string(Process.stdout(process)),
ProcessStream.string(Process.stderr(process))
)
)
)
but this will capture only stdout
pipe(
T.do,
T.bind("process", () => Command.command("ls")),
T.bind("stdout", ({ process }) => ProcessStream.string(Process.stdout(process))),
T.bind("stderr", ({ process }) => ProcessStream.string(Process.stderr(process)))
)
Describe the solution you'd like
To be able to capture stdout
and stderr
separately even when not running in parallel (as is done in the original implementation).
Describe alternatives you've considered
None
Additional context
I believe the root cause of the issue is how the NodeJS ReadableStream
is actually drained here. I am open to suggestions on alternative approaches. For reference, here is the original implementation.