D. J. Bernstein
UNIX
daemontools

The fghack program

fghack is an anti-backgrounding tool.

Interface

     fghack child

fghack runs child with many extra descriptors writing to a pipe. fghack reads and discards any data written to the pipe. After child has exited and the pipe has been closed, fghack exits.

fghack is designed to allow supervise to monitor child even if child is a silly daemon that insists on putting itself into the background. Normally fghack will not exit until all child's descendants have exited, since child's descendants will inherit the open pipe from child. However, fghack will exit early if child goes out of its way to close extra descriptors. (Some programs close most descriptors but leave stdin open, even though they do not use stdin; so you can try

     fghack child <&-
from /bin/sh.)