pub fn daemonize() -> Result<()>Expand description
Daemonize the current process
This function:
- Forks the process (first fork)
- Creates a new session with setsid()
- Forks again (second fork) to prevent acquiring a controlling terminal
- Redirects stdin/stdout/stderr to /dev/null
- Changes working directory to /
Returns Ok(()) in the daemon process, or an error if daemonization fails. The parent process exits immediately.