pub fn spawn_self_supervised() -> Result<SupervisedChild, Error>Expand description
Re-execs the current executable as a supervised child.
The child inherits every command-line argument after the program name, the whole environment, and the parent’s standard output and standard error. Two things change:
CHILD_ENV_MARKERis set, so the child knows it is supervised and its stdin watcher can detect daemon death.- Standard input becomes a pipe whose write end is returned inside the
SupervisedChildhandle.
Drop the SupervisedChild::stdin handle when the child should stop;
see the lifetime contract on SupervisedChild.