s6: the s6-fghack program
Keywords: s6 command s6-fghack foreground program background hack anti-backgrounding tool

s6
Software
skarnet.org

# The s6-fghack program

s6-fghack is an anti-backgrounding tool.

## Interface

         s6-fghack prog...

- s6-fghack opens a lot of file descriptors (all writing to a single pipe).
- Then it spawns prog... as a child.
- If something gets written on one of those descriptors, it's a bug in prog. s6-fghack then complains and exits 102.
- Unless prog... goes out of its way to close descriptors it does not know about, s6-fghack is able to detect when prog... exits. It exits with an approximation of the same exit code.

## Notes

s6-fghack is what it says: a hack. Ideally, you should never have to use it. It is only useful when you want to supervise a daemon that does not provide a "stay in the foreground" option; and even then, the right thing is to report this as a bug to the daemon author and have it fixed.