[erlang-questions] erlang port and C executable
Sun Nov 23 20:21:48 CET 2008
On Sun, Nov 23, 2008 at 2:08 PM, Per Hedeland <per@REDACTED> wrote:
> Johnny Billquist <bqt@REDACTED> wrote:
> >Per Hedeland wrote:
> >> "Edwin Fine" <erlang-questions_efine@REDACTED> wrote:
> >>> One of the most annoying aspects is that under
> >>> circumstances that are not clear to me, the C program that is spawned
> >>> sometimes does not seem to be sent a signal for end of file when you
> >>> the port, so if it is reading stdin, it's just going to sit there until
> >>> killed manually.
> >> This should never happen - i.e. there is no "signal" for end of file,
> >> it's just the result of reading when there is nothing more to read - but
> >> a port program that actually reads its stdin should always get end of
> >> file when the port is closed (after having read what there is to read,
> >> if anything). "You're probably doing something wrong."
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.
How about this for a suggestion: add an optional parameter to port_close:
Opts = [brutal_kill | polite_shutdown]
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions