[plt-scheme] subprocess: double fork() to avoid zombies
On Jul 21, Tom Schouten wrote:
> > > The idea being that in a lot of practical cases you don't care about
> > > a child's exit status. Doing it like this still allows you to shut
> > > down a child by closing its input port, which by most tools is
> > > interpreted as "exit", without ever having to care about zombie
> > > processes caused by not performing wait().
> >
> > How is this different? Specifically, you have wait()
> > synchronising on the forking subprocess, but you still need a
> > different wait() for the child that it creates -- no?
>
> Because the middle process dies before its child, the child is
> inherited by the `init' process. I believe this is the standard way
> on unix to start a daemon.
Isn't that problematic for getting the exit code? Can you even wait
for the process after that? The man entry says that a pid>0 means
"wait for the *child* whose ..."
But in any case, I think that Matthew's solution should work better,
and sounds like it would solve the problem.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!