[erlang-questions] How can I close standard input output streams and check for errors in Erlang?
Fri Jan 3 22:02:44 CET 2014
I checked on another forum previously at
and at the Erlang IRC channel on Freenode but I couldn't get help so
I've come to the mailing list. Can Erlang-Questions help me figure out
how to close standard input output streams and check for errors in
Erlang? I should be able to report an error if standard input and
output don't close properly and return an exit code of 1 if closing
standard error doesn't work.
> A simple hello world program is
> hello_world() -> io:fwrite("hello, world~n")
> I can compile and run this with erl -compile hello && erl -noshell -s
> hello hello_world -s init stop and it works. But what if I run it as
> erl -compile hello && erl -noshell -s hello hello_world -s init stop >
> /dev/full (on a Linux box)? That doesn't work correctly (correct
> behaviour should be reporting a full hard disk). *I know in C and Java
> I can close standard streams to flush them and check for errors but
> how can I do so in Erlang?
> *Strictly speaking one can't write this program correctly in portable
> C or Java either because operating system kernels like Linux defer
> writes so one has to do an fsync call for absolute correctness.
More information about the erlang-questions