pub fn fork_process<F>(
jail: Minijail,
keep_rds: Vec<RawDescriptor>,
debug_label: Option<String>,
post_fork_cb: F,
) -> Result<Child>where
F: FnOnce(),Expand description
Forks this process using [Minijail] and calls a closure in the new process.
After post_fork_cb returns, the new process exits with 0 code. If post_fork_cb panics, the
new process exits with 101 code.
This function never returns in the forked process.
ยงArguments
jail- [Minijail] instance to fork.keep_rds- [RawDescriptor]s to be kept in the forked process. other file descriptors will be closed by [Minijail] in the forked process.debug_label- (optional) thread name. this will be trimmed to 15 charactors.post_fork_cb- Callback to run in the new process.