[erlang-questions] fwrite on stdout

Ludovic Coquelle <>
Wed Jul 18 05:57:45 CEST 2007


Little question about io,

I run a command printing text on default io device (stdout) printing one
integer per line:
shell> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N])
end, lists:seq(1,5)), erlang:halt()."
1
2
3
4
5

But if I try to pipe the result to "truncate it", this print "1 2 3" then
crash!
shell> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N])
end, lists:seq(1,5)), erlang:halt()." | head -n 3
1
2
3
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

What's happening?
There should be a simple explanation, but what is it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070718/bd3e996c/attachment.html>


More information about the erlang-questions mailing list