[erlang-questions] escript questions

Per Hedeland per@REDACTED
Wed May 23 19:53:05 CEST 2007

Bengt Kleberg <bengt.kleberg@REDACTED> wrote:
>On 2007-05-23 02:13, ok wrote:
>>>> How do I write to stderr from a script?
>> Open an output stream to the Unix command 'cat 1>&2'.
>note that this mean that _everything_ written to stdout goes to stderr. 

Hm? I'm not 100% sure what Richard means by "Open an output stream", but
I would guess it's something like open_port({spawn, "cat 1>&2"}, [out]),
in which case only the data sent to that port goes to stderr, of course.

>if you want to write to both stdout and stderr you have to wait for a 
>new OTP.

No, it's seems we now have at least two ways to do it, as I posted a
slightly different one (more efficient:-) two days ago. For some value
of "write", that is - AFAIK there's no readily available way to create
an io_device() from such a "stupid" port.

--Per Hedeland

More information about the erlang-questions mailing list