Skip to main content

double_fork_into_background

Function double_fork_into_background 

Source
pub fn double_fork_into_background(log_path: &Path) -> Result<bool>
Expand description

Double-fork into background and redirect stdio to log_path.

Returns true for the daemon (grandchild) process and false for the original parent. The parent should print any status info then exit.

§Safety

Uses libc::fork() which is inherently unsafe in multi-threaded programs. Must be called before spawning any threads (i.e., before tokio runtime).