Kill forked processes
Steve Juranich
sjuranic at gmail.com
Sun Feb 26 17:11:01 EST 2006
kmkz wrote:
> I have a program A that forks off two other programs, B and C. I need B
> and C to both terminate if A is closed, but by using the
> subprocess.call() method this seems to not be the case; I can shut down
> the "black box" that is program A and B/C will still stay up.
>
> How can I achieve the desired behavior?
You'll probably need to take a look at the `signal' and `atexit' modules.
These will allow you to write hooks that will get called when your A script
is terminated either by a signal or by reaching one of the "natural"
endpoints.
--
Steve Juranich
Tucson, AZ
USA
More information about the Python-list
mailing list