You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Antonia Tugores <at...@gridsystems.com> on 2007/12/12 10:35:14 UTC
Trouble killing a process
Hi all,
I'm having some troubles killing a process (and its subprocesses).
The process type is APR_SHELLCMD_ENV, and when I call the apr_proc_kill with
the signal SIGABRT (with SIGKILL the results are the same), the parent
process (sh) dies but the child (sleep) doesn't.
main_program
/bin/sh -c ./"sleep.sh" 1 1 100 <---- dies
./sleep.sh 1 1 100 <---- remains
How can I kill the process and its subprocesses?
Thank you in advance
Antonia
Re: Trouble killing a process
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Antonia Tugores wrote:
> Hi all,
>
> I'm having some troubles killing a process (and its subprocesses).
> The process type is APR_SHELLCMD_ENV, and when I call the apr_proc_kill with
> the signal SIGABRT (with SIGKILL the results are the same), the parent
> process (sh) dies but the child (sleep) doesn't.
>
> main_program
> /bin/sh -c ./"sleep.sh" 1 1 100 <---- dies
> ./sleep.sh 1 1 100 <---- remains
>
> How can I kill the process and its subprocesses?
There's next to no way to enforce this behavior in a cross platform
manner. Even different shells on the same OS are going to exhibit
different features. Cleaning up your processes appropriately is
important. And this goes for shells, who should be watching for
SIGKILL/SIGABRT and reacting appropriately to the processes that
they had created.
This happens to be solaris? /usr/xpg4/bin/sh is a bit more reliable.