Skip to content

Commit

Permalink
expose child object
Browse files Browse the repository at this point in the history
usecases:
 - consumer would like to know the pid of the child process
 - consumer would like to kill the child process
  • Loading branch information
tsnoam authored and lpenz committed Apr 1, 2023
1 parent 01db9bf commit 996960f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ pub struct ChildStream<Sout, Serr> {
}
}

impl<Sout, Serr> ChildStream<Sout, Serr> {
/// Return a reference to the child object
pub fn child(&self) -> Option<&Child> {
self.child.as_ref()
}

/// Return a mutable reference to the child object
pub fn child_mut(&mut self) -> Option<&mut Child> {
self.child.as_mut()
}
}

impl<Sout, Serr> TryFrom<Command> for ChildStream<Sout, Serr>
where
ChildStream<Sout, Serr>: From<Child>,
Expand Down

0 comments on commit 996960f

Please sign in to comment.