[erlang-questions] escript cutting output
Thu Nov 17 10:19:44 CET 2011
Erlang IO is handled by a separate process. It is probably still
outputting when your escript exits.
Using "|cat" speed up the output.
Using timer:sleep() wait for it to finish.
Both are right. You are not doing anything wrong.
On Thu, 2011-11-17 at 09:54 +0100, Samuel wrote:
> S***t! Now I'm reaching the list, but gmail ate all my whitespace.
> Reformatted below:
> I'm having trouble with an escript that outputs quite a lot of
> information and I'm not sure where I have to look for a clean
> solution. I traced my problem down to next simple escript:
> #!/usr/bin/env escript
> main(_) ->
> io:format("~p~p~n", [lists:duplicate(100000, $a), b]).
> If I run this in a linux terminal emulator the output gets cut
> somewhere in the middle of the a characters, the b never shows:
> $ io_test
> I found several ways of getting it to work, but none convincing. E.g.:
> * Putting cat in the middle:
> $ io_test | cat
> * Putting a timer:sleep(1000) after the io:format works also
> I tried calling init:stop() before exiting in the hope of it waiting
> for the io system to exit clenaly, but that didn't make any
> Any ideas about what I'm doing wrong?
More information about the erlang-questions