I want to write a some kind of supervisor and I’m trying to implement function that closes an external program. The external process is connected to an erlang’s code with a port. I have no idea how to close this program, by sending a signal or anything else. Closing a port is not a solution, becouse I’ve checked that many programs doesn’t exit on SIGPIPE. Have you got any ideas how to do it?
Share
You can use
to get the pid of the process in the OS (see http://erlang.org/doc/man/erlang.html#port_info-1 – I think you may need a recent version of Erlang for this to be included, I think the one installed by apt-get on Ubuntu 12.04 isn’t recent enough, I know R15B02 has it though) and then
to kill it (http://erlang.org/doc/man/os.html#cmd-1).