[erlang-questions] escript cutting output

Samuel <>
Thu Nov 17 09:54:49 CET 2011


S***t! Now I'm reaching the list, but gmail ate all my whitespace.
Reformatted below:

Hi,

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
"aaaaaaaaaaa.....aaa$

I found several ways of getting it to work, but none convincing. E.g.:

 * Putting cat in the middle:

$ io_test | cat
"aaaaa...aaaaaaaa"b
$

 * 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
difference.

Any ideas about what I'm doing wrong?
-- 
Samuel



More information about the erlang-questions mailing list