[erlang-questions] how do I get escript to emit all output before exiting?

Robert Virding robert.virding@REDACTED
Fri Apr 8 19:01:16 CEST 2011

I haven't looked at this in a long time but my first initial reaction is surprise that would have to do init:stop() at all in main(), I would have expected the escript "wrapping" to handle that cleanly for you. And ensure that all io is complete.

Doing an io:format/put_chars does ensure that the characters have been sent to the io-server and been processed there. With terminal and file output they will also have been sent to the port, though depending on type of io-server this is no guarantee. If the output is still "stuck" in the driver then I don't know what happens. I would have expected them to be flushed if they have been closed "normally".


Robert Virding, Erlang Solutions Ltd.

More information about the erlang-questions mailing list