[erlang-questions] How do you kill an OS process that was opened with open_port on a brutal_kill?
Fri Nov 25 11:27:09 CET 2016
If I remember correctly, the stdin of the program started with open_port
will be closed when the Erlang VM terminates. So if the OS process is
listening to stdin and exiting when the stdin closes, you don't need to
worry about terminating it.
When they don't do so, you can also write a script that spawns the OS
process and traverses stdin until it closes and then it terminates the OS
process when stdin closes. Something like:
while read line ; do
done < /dev/stdin
kill -KILL $pid
If you save it as "wrap" then you can start your OS process as "wrap NAME
ARGS". This can be handy if you cannot rely on C/C++ extensions. If anyone
knows any drawback to such approach, I would love to hear.
Founder and Director of R&D
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions