killing all subprocess childrens

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Sep 3 02:45:44 EDT 2010


In message <mailman.351.1283397136.29448.python-list at python.org>, Astan Chee 
wrote:

> What I'm trying to do (and wondering if its possible) is to make sure
> that any children (and any descendants) of this process is killed when
> the main java process is killed (or dies).
> How do I do this in windows, linux and OSX?

A linux-specific solution could be implemented in terms of cgroups 
<http://www.mjmwired.net/kernel/Documentation/cgroups.txt>. I can’t see any 
way to automatically ensure all descendants are killed, but the parent can 
at least scan the cgroup when the immediate child exits, and kill every 
leftover process it finds.



More information about the Python-list mailing list