kill childs
Martin v. Loewis
martin at v.loewis.de
Wed Feb 27 15:26:38 EST 2002
"Christian Schmidt" <christian.schmidt at REMOVEaifb.uni-karlsruhe.de> writes:
> I use Python to start other commands via os.system("cmdline")
> When I kill the script with 'kill <scriptpid>' the command is not killed,
> only the script.
> How can I kill the child, too?
> Can I use something like os.kill(-1) in an except-statement?
If you use os.system, you cannot find out what the pid of the child
is. So as a prerequisite, you need to replace the call to system()
with a fork/exec sequence. Then, you can install a signal handler
(using signal.signal) to kill the subprocesses if any.
Regards,
Martin
More information about the Python-list
mailing list