pub fn write_pid_file() -> Result<()>Expand description
Write the current process ID to the PID file atomically.
Uses a temp file + rename pattern to prevent partial writes.
The temp file is created with create_new(true) to avoid following symlinks.