Skip to content

Commit 56f02d1

Browse files
Rollup merge of #164151 - RalfJung:parent_id_test, r=joshtriplett
std: add doctest to parent_id This operation is currently entirely untested. (I know because it shows up nowhere in the test failures when running the test suite in Miri, and Miri does not support this operation.) So let's add a test.
2 parents 443d658 + 0103672 commit 56f02d1

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎library/std/src/os/unix/process.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,15 @@ impl From<OwnedFd> for process::ChildStderr {
747747
}
748748

749749
/// Returns the OS-assigned process identifier associated with this process's parent.
750+
///
751+
/// # Example
752+
///
753+
#[cfg_attr(target_family = "unix", doc = "```")]
754+
#[cfg_attr(not(target_family = "unix"), doc = "```ignore (needs unix)")]
755+
/// use std::os::unix::process;
756+
/// let parent = process::parent_id();
757+
/// println!("The parent process has ID {}", parent);
758+
/// ```
750759
#[must_use]
751760
#[stable(feature = "unix_ppid", since = "1.27.0")]
752761
pub fn parent_id() -> u32 {

0 commit comments

Comments
 (0)