[Ilugc] Killing an enitre process tree

  • From: prashmohan@xxxxxxxxx (Prashanth Mohan)
  • Date: Sun Oct 29 13:08:13 2006

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hello!

How do I send a TERM or KILL signal to a child process and all its
subsequent children?

Let me explain my situation. My Program (in python) uses the subprocess
module to start a new executable. Now because I pass 'shell=True', a new
shell is started and that shell spawns a the executable. Now I want to
kill all the spawned processes. If I try to send the TERM or KILL signal
to the pid which subprocess returns, only the shell is being killed, the
other process continues execution.

The situation is so. Py_Prog1 --> Shell --> Prog2. Now I want to kill
both Shell and Prog2. How do I do that?

Thanks,
- --
Prashanth Mohan
http://prashblog.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFFRFpWe6gWeYDScTIRAhz7AKClMs1pek3frF/6sKXir+BbjrEmAQCeIsHB
CM8bgKW1IUCAwmwFJCC/Ky0=
=Ergd
-----END PGP SIGNATURE-----

Other related posts: