[erlang-questions] port_close/1 problem
Serge Aleynikov
saleyn@REDACTED
Wed Oct 31 14:05:50 CET 2007
I reread this email and realized that I forgot to mention the fact that
in my understanding port_close/1 merely closes its end of the pipe used
to communicate with the port process. So in this case if the running
port program is in the middle of a blocking call it won't detect the
closing of the file descriptor it uses to communicate with Erlang and
will continue running. So if I wanted to kill that port by sending an
appropriate signal from Erlang how can I determine the OS pid of the port?
The obvious answer is to communicate that OS pid back to Erlang through
the pipe, but in this particular case it takes over two to three minutes
before the port loads all components and starts reading its end of the
pipe, and I'd like to be able to kill it prior to that.
Any suggestions?
Serge
Serge Aleynikov wrote:
> Hi,
>
> I am having a problem shutting down a port program started using
> open_port({spawn, Exe}, [binary, {packet, 2}, nouse_stdio, exit_status]).
>
> When the owner Pid dies or explicitly calls port_close(Port) the linked
> OS process remains running. It is a 3rd party binary interpreter. Is
> it because it might be intercepting SIGINT or some other signals?
>
> Is there a way to figure out it's OS pid and shut it down or is there a
> "proper" way of killing it from within the emulator? (doing
> os:cmd("pkill ExeName") is not an option as there might be many
> instances of ExeName running. I looked through port_info/1 options but
> don't see a way of determining port's OS pid.
>
> Serge
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list