pub struct PrivateChild { /* private fields */ }Expand description
A child started with a PrivateSecret on its stdin. Dropping it closes the pipe (the
child’s cue to exit) and then the owned child is terminated by its own Drop.
Implementations§
Source§impl PrivateChild
impl PrivateChild
Sourcepub fn spawn(command: OwnedCommand) -> Result<Self>
pub fn spawn(command: OwnedCommand) -> Result<Self>
Start command with a fresh secret. Stdin is replaced with a pipe; the secret is
written as the first line and the pipe stays open for the child’s lifetime. Put nothing
secret in the arguments or environment.
Sourcepub fn spawn_with(command: OwnedCommand, secret: PrivateSecret) -> Result<Self>
pub fn spawn_with(command: OwnedCommand, secret: PrivateSecret) -> Result<Self>
spawn with a secret the caller made.
Sourcepub fn spawn_with_extra(
command: OwnedCommand,
secret: PrivateSecret,
extra_line: Option<&str>,
) -> Result<Self>
pub fn spawn_with_extra( command: OwnedCommand, secret: PrivateSecret, extra_line: Option<&str>, ) -> Result<Self>
spawn_with for a child whose handshake is more than the secret: the
secret line, then extra_line (for example a path or a second key), both written before
this returns. extra_line must not contain a newline; a line that does is refused with
InvalidInput before the child starts.
Sourcepub fn write_line(&mut self, line: &str) -> Result<()>
pub fn write_line(&mut self, line: &str) -> Result<()>
Write one more line to the child’s stdin after the handshake and flush it. Fails with
BrokenPipe once the stdin is closed. line must not contain a newline.
Sourcepub fn secret(&self) -> &PrivateSecret
pub fn secret(&self) -> &PrivateSecret
The secret to give a ClientConfig.
Sourcepub fn child(&self) -> &OwnedChild
pub fn child(&self) -> &OwnedChild
The owned child, for waiting, termination and the rest of its lifecycle.
Sourcepub fn child_mut(&mut self) -> &mut OwnedChild
pub fn child_mut(&mut self) -> &mut OwnedChild
Mutable access to the owned child.
Sourcepub fn close_stdin(&mut self)
pub fn close_stdin(&mut self)
Close the child’s stdin: the polite request to exit. Idempotent.