[erlang-questions] escript questions

ok ok@REDACTED
Thu May 24 01:27:07 CEST 2007


Someone asked "How do I write to stderr from a script?"
I replied "Open an output stream to the Unix command 'cat 1>&2'.

On 23 May 2007, at 7:00 pm, Bengt Kleberg wrote:
> note that this mean that _everything_ written to stdout goes to  
> stderr.

No it doesn't.  Output written to THAT STREAM ONLY will be forwarded
to stderr; output written to Erlang's own stdout will be entirely
unaffected.

What I'm talking about is this:

     P = open_port({spawn,'cat 1>&2'}, [out,use_stdio,{line,256}]),
     port_command(P, "Error Message.\n")

Come to think of it, there is also

     Q = open_port({fd,0,2}, [out,{line,256}],
     port_command(Q, "xyzzy\n")





More information about the erlang-questions mailing list