in reply to Automatically killing a child

I don't see any children. exec doesn't spawn children. exec executes a program in the current process. In other words, tail and the program that launches it are never running at the same time, because tail was launched via exec.

In fact, it looks like you executed your script twice. Once as process 7755, and once as process 7756.

Update: Nevermind. Apparently open -| returns the child pid. I don't see any mention of this in the docs. If open returned its usual status, exec would only get called when the pipe failed, and that's the scenerio I thought we had.

Replies are listed 'Best First'.
Re^2: Automatically killing a child
by Fletch (Bishop) on May 19, 2006 at 15:27 UTC
    If you open a pipe on the command '-' , i.e., either '|-' or '-|' with 2-arguments (or 1-argument) form of open(), then there is an implicit fork done, and the return value of open is the pid of the child within the parent process, and 0 within the child process.

    It's in there, just hidden way on down.