I'm trying to figure out how to pull the stdout and stderr from a system subprocess in Erlang. (Not to be confused with an Erlang process.) The gotcha is I'm trying to pull the output of the streams independently.
open_port/2 seems to get me most of the way there, however it doesn't seem to provide a way to differentiate between the two streams. There is the stderr_to_stdout option, but that's not what I want; I want to get data from both data streams but be able to distinguish the two streams.
Any suggestions? Thanks.
Update: I'm ideally looking for a solution that will work on both Windows and Linux.
You may want to try erlexec. As its documentation explains, it allows separate control over stdout and stderr, and in general it's much more flexible than open_port/2
for managing OS processes from Erlang.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments