diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs index 9fa731de82691..a498ff49d6971 100644 --- a/library/std/src/os/unix/process.rs +++ b/library/std/src/os/unix/process.rs @@ -747,6 +747,15 @@ impl From for process::ChildStderr { } /// Returns the OS-assigned process identifier associated with this process's parent. +/// +/// # Example +/// +#[cfg_attr(target_family = "unix", doc = "```")] +#[cfg_attr(not(target_family = "unix"), doc = "```ignore (needs unix)")] +/// use std::os::unix::process; +/// let parent = process::parent_id(); +/// println!("The parent process has ID {}", parent); +/// ``` #[must_use] #[stable(feature = "unix_ppid", since = "1.27.0")] pub fn parent_id() -> u32 {