<br><br><div class="gmail_quote">On Sun, Nov 23, 2008 at 2:08 PM, Per Hedeland <span dir="ltr"><<a href="mailto:per@hedeland.org">per@hedeland.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Johnny Billquist <<a href="mailto:bqt@softjar.se">bqt@softjar.se</a>> wrote:<br>
><br>
>Per Hedeland wrote:<br>
>> "Edwin Fine" <<a href="mailto:erlang-questions_efine@usa.net">erlang-questions_efine@usa.net</a>> wrote:<br>
>>> One of the most annoying aspects is that under<br>
>>> circumstances that are not clear to me, the C program that is spawned<br>
>>> sometimes does not seem to be sent a signal for end of file when you close<br>
>>> the port, so if it is reading stdin, it's just going to sit there until<br>
>>> killed manually.<br>
>><br>
>> This should never happen - i.e. there is no "signal" for end of file,<br>
>> it's just the result of reading when there is nothing more to read - but<br>
>> a port program that actually reads its stdin should always get end of<br>
>> file when the port is closed (after having read what there is to read,<br>
>> if anything). "You're probably doing something wrong."<br>
></div></blockquote><div><br>I misspoke (miswrote :) about the signal. <Hits head> Of course closing a write pipe will make the reading program receive an EOF - everything's a file in Unix (except the things that aren't ;). Sorry. I should learn not to post at 2am.<br>
<br></div></div>How about this for a suggestion: add an optional parameter to port_close:<br><br>erlang:port_close(Port, Opts)<br>Opts = [brutal_kill | polite_shutdown]<br><br>Omitting the opts will give the same behavior as current; adding a [brutal_kill] will do the equivalent of a kill -9; polite shutdown just a "normal" kill.<br>
<br>Regards,<br>Edwin Fine<br><br>