[erlang-questions] escript cutting output

Bob Gustafson bobgus@REDACTED
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:
>   http://erlang.org/pipermail/erlang-questions/2011-April/057492.html
> My take is that there is no proper solution. Adding a 'sufficient'
> timer:sleep works in practice, but it's less than completely
> satisfying.
> Matt
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list