I've got a pretty strange use case for s6-supervise, but making it work
takes a pretty minor patch. I've a convenience tool wrapped around
s6-supervise using it for interactive development, called "pgctl". One of
the modes, pgctl-debug, foregrounds the service. I'd like to run
s6-supervise in this mode as it makes the behavior and implementation much
more uniform, and this is what I did for a long time, but there's one major
flaw. Most debuggers helpfully catch SIGINT and print something instead of
dying. s6-supervise (understandably) doesn't handle SIGINT and dies, the
end result being that when a user hits ctrl+c, s6-supervise dies and the
debugger lives, after which the shell starts reading from stdin again. This
results in two competing prompts from the shell and debugger, and roughtly
every other keystroke going to the shell or debugger. This is pretty
hellish for users.

I discussed this at length with skarnet on #s6, and ... I forget all of the
reasoning, but we settled on adding a special case for the nosetsid file
containing "setpgid" to setpgid() rather than setsid().

The requirement being that (it's possible to) in an interactive setting
foreground the supervised service, while setting the supervisor as a
backgrounded process.

Reply via email to