[erlang-questions] How do you kill an OS process that was opened with open_port on a brutal_kill?

Raimo Niskanen raimo+erlang-questions@REDACTED
Fri Nov 25 11:05:11 CET 2016


On Fri, Nov 25, 2016 at 03:53:32AM +0000, Vans S wrote:
> So far if I use open_port({spawn, Params}, [stderr_to_stdout, exit_status]) to create an OS process, if the erlang process that created it dies, the os process stays alive.  I want the os process to die with the erlang process, often this is the case if the process reads stdin.
> 
> Currently this process does not read stdin and it does not die when the erlang process dies.
> 
> Any ideas how to do this?

I have used a wrapper script that prints the process number on stdout and
then execs the target program.  Then I can kill the spawned process using
os:cmd or such.

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list