<a href="http://erlang.org/doc/man/erlang.html#halt-2">According to the documentation</a>, erlang:halt/2 should flush unless {flush,false} is given:<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:medium;background-color:rgb(255,255,255)">For integer </span><span class="code" style="font-family:Courier,monospace;font-size:medium;background-color:rgb(255,255,255)">Status</span><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:medium;background-color:rgb(255,255,255)"> the Erlang runtime system closes all ports and allows async threads to finish their operations before exiting. To exit without such flushing use </span><span class="code" style="font-family:Courier,monospace;font-size:medium;background-color:rgb(255,255,255)">Option</span><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:medium;background-color:rgb(255,255,255)"> as </span><span class="code" style="font-family:Courier,monospace;font-size:medium;background-color:rgb(255,255,255)">{flush,false}</span><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:medium;background-color:rgb(255,255,255)">.</span></blockquote>
<div><br></div><div><div>However, we noticed that erlang:halt(0, []) is not flushing at all. Looking at the code, we were able to verify it:</div><div><br></div><div><a href="https://github.com/erlang/otp/blob/a5fc79292b9b018cd39d104a8cd2e79de141e3ad/erts/emulator/beam/bif.c#L3937">https://github.com/erlang/otp/blob/a5fc79292b9b018cd39d104a8cd2e79de141e3ad/erts/emulator/beam/bif.c#L3937</a></div>
<div><br></div><div>The value of flush should be initialized to 1.</div><div><br></div><div>Thank you!</div><div><br></div><div>PS: erlang:halt/0 and erlang:halt/1 **are** working as advertised.</div><div><br></div><div>
<div>
<div><br></div><div><span style="font-size:13px"><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b>José Valim</b></span></div><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><div>
<span style="font-family:verdana,sans-serif;font-size:x-small"><a href="http://www.plataformatec.com.br/" style="color:rgb(42,93,176)" target="_blank">www.plataformatec.com.br</a></span></div><div><span style="font-family:verdana,sans-serif;font-size:x-small">Skype: jv.ptec</span></div>
<div><span style="font-family:verdana,sans-serif;font-size:x-small">Founder and Lead Developer</span></div></span></div></span></div></div>
</div></div>