[][src]Crate fork

Library for creating a new process detached from the controling terminal (daemon).

Example:

use fork::{daemon, Fork};
use std::process::Command;

fn main() {
   if let Ok(Fork::Child) = daemon(false, false) {
       Command::new("sleep")
           .arg("3")
           .output()
           .expect("failed to execute process");
   }
}

Enums

Fork

Fork result

Functions

chdir

Change dir to / see chdir(2)

close_fd

close file descriptors stdin,stdout,stderr, returns -1 if error

daemon

The daemon function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons.

fork

Create a new child process see fork(2)

setsid

Create session and set process group ID see setsid(2)