containers / bubblewrap

Low-level unprivileged sandboxing tool used by Flatpak and similar projects
Other
3.9k stars 238 forks source link

enhancement: --daemonize-with-child option #614

Open jonleivent opened 9 months ago

jonleivent commented 9 months ago

It would be nice if bwrap had a --daemonize-with-child option that daemonizes the outer bwrap when the first child process within bwrap daemonizes (exits but leaves other processes running). This would improve how well bwrap ... cmd... matches the behavior of cmd... with respect to its parent script. Obviously, --daemonize-with-child could not be paired with --as-pid-1.

Use case: I bwrap a server app that does some complex initialization, then daemonizes when it is ready to accept clients. This allows the parent script to delay client startup until the server is ready. Without --daeminize-with-child, I have to poll to determine when the server is ready, or use a wrapper script around the server that signals the parent script when the server daemonizes, or modify the server app to do some other kind of signalling.