killing all subprocess childrens

Astan Chee astan.chee at al.com.au
Thu Sep 2 05:30:40 CEST 2010


Chris Rebert wrote:
> import os
> import psutil # http://code.google.com/p/psutil/
>
> # your piece of code goes here
>
> myself = os.getpid()
> for proc in psutil.process_iter():
>   
Is there a way to do this without psutil or installing any external 
modules or doing it from python2.5?
Just wondering.
Thanks again
>     if proc.ppid == myself:
>         proc.kill()
>
> Cheers,
> Chris
> --
> http://blog.rebertia.com
>   



More information about the Python-list mailing list