[erlang-questions] port_close/1 problem

Serge Aleynikov saleyn@REDACTED
Wed Oct 31 15:49:56 CET 2007


Per Hedeland wrote:
> Hm, but after it has done that loading, this "3rd party binary
> interpreter" will actually start communicating with Erlang on fd 3/4,
> using {packet, 2} format? 

Yes, if everything goes well in the initialization step.

> I guess not, i.e. you probably have some
> wrapper around it - and if so, can't you send the pid from the wrapper
> code *before* doing all the loading?

I don't have a wrapper - the interpreter does some heavy weight 
initialization (loading a bunch (~ 200!!!) of shared objects) and at 
some point will evaluate my script that would communicate with Erlang 
through a pipe.  If anything goes wrong I'd like to be able to kill the 
beast by sending a fatal signal (and it would not be desirable to 
introduce some light-weight middleman process that would sit between 
Erlang and the interpreter and do all intermediate pipe marshaling).

> Alternatively, you could experiment with something along the lines of
> 
>  {spawn, Exe ++ " & echo $!"}
> 
> That obviously won't work as-is with {packet, 2}, so it has to be a bit
> more complex, and the backgrounding *might* mess up the pipe plumbing,
> but I don't really think it should.

Thanks, I'll try, though I am doubtful that sending a process in the 
background won't hurt the piping setup.

Serge



More information about the erlang-questions mailing list