[erlang-questions] escript cutting output
Fri Nov 18 16:03:22 CET 2011
The critical sentence in the post mentioned below is:
"What I suspect is actually happening is that your output is in
the port buffer, which isn't explicitly flushed during halt or
shutdown. With a sufficient timer:sleep(), it will be, but no
other amount of trickery will suffice."
The solution is to explicitly flush the output *in your code* before you
The io:flush is tied to that buffer write and will return when its job
is complete (the flush). A timer is not tied to anything in the buffer
mechanism and in practice will be either too short a time (not all is
written), or too long (program is inefficient timewise) or erratic as
unforeseen things happen in the output channel.
On Fri, 2011-11-18 at 07:51 +0100, Matthias Lang wrote:
> FWIW, I think this is exactly the same problem as covered in a thread
> earlier this year. Probably the most interesting post in that thread:
> My take is that there is no proper solution. Adding a 'sufficient'
> timer:sleep works in practice, but it's less than completely
> erlang-questions mailing list
More information about the erlang-questions