pub struct SpawnedChild {
pub stdin: Option<ChildStdin>,
pub stdout: Option<ChildStdout>,
pub stderr: Option<ChildStderr>,
/* private fields */
}Expand description
Handle and optional parent pipe ends for a contained child.
Dropping this value shuts down the contained process group.
Fields§
§stdin: Option<ChildStdin>Writable parent end when standard input was configured as a pipe.
stdout: Option<ChildStdout>Readable parent end when standard output was configured as a pipe.
stderr: Option<ChildStderr>Readable parent end when standard error was configured as a pipe.
Implementations§
Source§impl SpawnedChild
impl SpawnedChild
Sourcepub fn from_parts(
pid: u32,
stdin: Option<ChildStdin>,
stdout: Option<ChildStdout>,
stderr: Option<ChildStderr>,
inner: Box<dyn SpawnedChildControl>,
) -> SpawnedChild
pub fn from_parts( pid: u32, stdin: Option<ChildStdin>, stdout: Option<ChildStdout>, stderr: Option<ChildStderr>, inner: Box<dyn SpawnedChildControl>, ) -> SpawnedChild
Transfer caller-owned pipes and lifecycle control into this handle.
This constructor does not launch a process or establish containment.
The caller must supply the matching PID, pipes, and control for an
already-contained child. Dropping the returned handle invokes
SpawnedChildControl::shutdown; the supplied control owns the actual
termination and reaping policy.
Sourcepub fn kill(&mut self) -> Result<(), Error>
pub fn kill(&mut self) -> Result<(), Error>
Forcibly terminate the child on a best-effort basis.
Trait Implementations§
Source§impl Drop for SpawnedChild
impl Drop for SpawnedChild
Source§impl SessionChild for SpawnedChild
impl SessionChild for SpawnedChild
Source§type Stdin = ChildStdin
type Stdin = ChildStdin
Parent-side writer for the child’s stdin.
Source§type Stdout = ChildStdout
type Stdout = ChildStdout
Parent-side reader for the child’s stdout.
Source§type Stderr = ChildStderr
type Stderr = ChildStderr
Parent-side reader for the child’s stderr.
Source§fn take_stdin(&mut self) -> Option<Self::Stdin>
fn take_stdin(&mut self) -> Option<Self::Stdin>
Take the stdin writer.
None if stdin was not piped or already taken.Source§fn take_stdout(&mut self) -> Option<Self::Stdout>
fn take_stdout(&mut self) -> Option<Self::Stdout>
Take the stdout reader.
None if stdout was not piped or already taken.Source§fn take_stderr(&mut self) -> Option<Self::Stderr>
fn take_stderr(&mut self) -> Option<Self::Stderr>
Take the stderr reader.
None if stderr was not piped or already taken.Source§fn wait_session(&mut self) -> Result<SessionExit>
fn wait_session(&mut self) -> Result<SessionExit>
Block until the child exits and report its
SessionExit.Auto Trait Implementations§
impl Freeze for SpawnedChild
impl RefUnwindSafe for SpawnedChild
impl Send for SpawnedChild
impl Sync for SpawnedChild
impl Unpin for SpawnedChild
impl UnsafeUnpin for SpawnedChild
impl UnwindSafe for SpawnedChild
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more