[erlang-questions] Separate messages from stdout and stderr of a port

Alexey Romanov alexey.v.romanov@REDACTED
Mon Nov 22 16:19:42 CET 2010


On Mon, Nov 22, 2010 at 5:55 PM, Samuel Rivas
<samuel.rivas@REDACTED> wrote:
>> I can get the output of a spawned port on its stderr stream by using
>> stderr_to_stdout. However,
>> is there a way to get messages from the port's stdout and stderr
>> separately? I don't see one in
>> http://www.erlang.org/doc/man/erlang.html
>> In fact, it would be enough for my purposes to only get stderr and
>> ignore stdout.
>
> If you just want to do that you can use standard shell redirection,
> since port commands are evaluated in a shell process.
>
> the-port-command 2>&1 > /dev/null
>
> Should be enough to trash all stdout and redirect stderr to stdout

Right, simple and nice.

Yours, Alexey Romanov


> Cheers
> --
> Samuel
>


More information about the erlang-questions mailing list