Since the child is using `` (or qx() for the pedantic), it won't know the pid of its child, so it will have to use ps or something like it to find out... which essentially brings us back to the kludge I posted earlier. :(

The proper way to do this would be to, as wren suggests, fork another child and then exec the command from there, but capturing that output is pretty difficult.

On Aug 2, 2006, at 11:22 PM, Ted Zeng wrote:
I gave this some thought. But since the child process doesn't know its child
process's pid, how could it kill the grandchild process?

ted

On 8/2/06 5:16 PM, "Joel Rees" <[EMAIL PROTECTED]> wrote:

One way of seeing that the grandfather process can terminate
grandchild processes is to have the child process catch the signal
and kill, in turn, its own child processes, as part of its clean-up
code before it dies. This means that you have to use a signal that
can be recovered from when killing the child process.

--
Packy Anderson [EMAIL PROTECTED]

On the internet, no one knows you're a CHICKEN! A GIANT CHICKEN!


Reply via email to