Little question about io,<br><br>I run a command printing text on default io device (stdout) printing one integer per line:<br>shell> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) end, lists:seq(1,5)), erlang:halt()."
<br>1<br>2<br>3<br>4<br>5<br><br>But if I try to pipe the result to "truncate it", this print "1 2 3" then crash!<br>shell> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) end, lists:seq(1,5)), erlang:halt()." | head -n 3
<br>1<br>2<br>3<br>Crash dump was written to: erl_crash.dump<br>init terminating in do_boot ()<br><br>What's happening?<br>There should be a simple explanation, but what is it?<br>