Skip to content

Commit

Permalink
Add ErasedChild::id()
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Nov 4, 2023
1 parent 9aa3d73 commit 3834898
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Next (YYYY-MM-DD)

- Add `ErasedChild::id()` method.

## v4.0.0 (2023-11-05)

- Clarify why and in which situations `AsyncGroupChild::wait` may not behave as expected when cancelled.
Expand Down
11 changes: 11 additions & 0 deletions src/stdlib/erased.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ pub enum ErasedChild {
}

impl ErasedChild {
/// Returns the OS-assigned process (group) identifier.
///
/// - Grouped: [`GroupChild::id`]
/// - Ungrouped: [`Child::id`]
pub fn id(&mut self) -> u32 {
match self {
Self::Grouped(c) => c.id(),
Self::Ungrouped(c) => c.id(),
}
}

/// Forces the child to exit.
///
/// - Grouped: [`GroupChild::kill`]
Expand Down
11 changes: 11 additions & 0 deletions src/tokio/erased.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ pub enum ErasedChild {
}

impl ErasedChild {
/// Returns the OS-assigned process (group) identifier.
///
/// - Grouped: [`AsyncGroupChild::id`]
/// - Ungrouped: [`Child::id`]
pub fn id(&mut self) -> Option<u32> {
match self {
Self::Grouped(c) => c.id(),
Self::Ungrouped(c) => c.id(),
}
}

/// Forces the child to exit.
///
/// - Grouped: [`AsyncGroupChild::kill`]
Expand Down

0 comments on commit 3834898

Please sign in to comment.