[erlang-questions] Stopping spawned process

andrew mmc andrewmmc@REDACTED
Sun Nov 29 17:59:34 CET 2009


Hello,

What about taking the following steps:

1. spawn the child process using a bash/whatever script which writes the ID
of the process to a file in a specific directory and then runs mplayer;
2. launch your application also using a script, so that when the VM dies or
your application closes, the script then checks that directory for PID files
then kills them one by one.

It is clunky but should get the job done reliably.

Andrew

On Sun, Nov 29, 2009 at 3:31 PM, Erik Reitsma <erlang@REDACTED> wrote:

> I checked what happens with other languages. In Python the behavior is
> similar to in Erlang, when I use subprocess.Popen: the child process stays
> alive when the Python process terminates. In Java, however, the child
> process is killed. Probably a list of child processes is maintained, and the
> children are sent a kill signal when the JVM is killed. In Erlang I do not
> get direct access to the PID of the child, neither do I get the opportunity
> to do anything when Erlang terminates (or do I?).
>
> Another process watcher would be a bit heavy for my purpose: a wrapper
> around mplayer, as a client to a DVB-S media server.
>
>
> Max Lapshin wrote:
>
>> There is no guaranteed way to kill child process in common unix =(
>> Maybe another process watcher.
>>
>> ________________________________________________________________
>> erlang-questions mailing list. See http://www.erlang.org/faq.html
>> erlang-questions (at) erlang.org
>>
>>
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list