pub struct ExecChild { /* private fields */ }Expand description
A running guest process. Hold this until you call wait or
drop it; dropping closes the agent connection, which kills the
child via the agent’s SIGHUP propagation.
Implementations§
Source§impl ExecChild
impl ExecChild
Sourcepub fn stdin(&mut self) -> Option<ExecStdin>
pub fn stdin(&mut self) -> Option<ExecStdin>
Take ownership of the stdin handle. Calling this twice
returns None the second time.
Sourcepub fn stdout(&mut self) -> Option<ExecStdout>
pub fn stdout(&mut self) -> Option<ExecStdout>
Take ownership of stdout. Returns a Reader. Useful when
you want to spawn your own pump thread.
Sourcepub fn stderr(&mut self) -> Option<ExecStderr>
pub fn stderr(&mut self) -> Option<ExecStderr>
Take ownership of stderr. Empty in tty mode.
Sourcepub fn signal(&self, signum: i32) -> Result<()>
pub fn signal(&self, signum: i32) -> Result<()>
Send a signal (SIGTERM/SIGINT/…) to the guest process.
Sourcepub fn signaler(&self) -> ExecSignaler
pub fn signaler(&self) -> ExecSignaler
Hand back a Send + Sync + Clone handle for
signaling THIS child from another thread. The returned handle
can outlive the ExecChild — after the child exits, calls
on the signaler become no-ops on the closed socket (no panic,
no deadlock).
Typical use: register the signaler in a cancellation registry, move the child into a wait thread, fire the registry slot (e.g. on user-cancel or pool-shutdown) to interrupt.
Cost: one atomic refcount increment.
Sourcepub fn abort(&self) -> Result<()>
pub fn abort(&self) -> Result<()>
Close the host-side socket (shutdown(Both)) WITHOUT waiting
for a clean exit. The demux thread observes EOF and exits;
a concurrent wait / output returns
Err(UnexpectedEof). Use this when you’ve already decided
the child should stop right now — e.g. a pool shutdown
killed the worker and the in-flight wait would otherwise
hang.
Equivalent to self.signaler().abort(). Provided here for
the common case where you have the child handle directly.
Sourcepub fn try_wait(&self) -> Result<Option<(ExitStatus, Option<u64>)>>
pub fn try_wait(&self) -> Result<Option<(ExitStatus, Option<u64>)>>
Non-consuming poll. Returns Ok(Some(_)) if the child has
exited (and reaps the exit status), Ok(None) if it’s still
running, Err(_) on demux failure. Mirrors
std::process::Child::try_wait — useful when you want to
register the signaler with a registry AND periodically check
completion without committing to a blocking wait.
Sourcepub fn resize(&self, cols: u16, rows: u16) -> Result<()>
pub fn resize(&self, cols: u16, rows: u16) -> Result<()>
Resize the pty (tty mode only). No-op in pipe mode (the agent ignores RESIZE frames if no pty is attached).
Sourcepub fn wait(self) -> Result<ExitStatus>
pub fn wait(self) -> Result<ExitStatus>
Block until the guest process exits. Returns the exit status (or a synthesized one if the agent disconnected).
Sourcepub fn wait_with_rss(self) -> Result<(ExitStatus, Option<u64>)>
pub fn wait_with_rss(self) -> Result<(ExitStatus, Option<u64>)>
Like ExecChild::wait but also surfaces the peak RSS
the agent reports (Some(kib) for v0.2.x+ agents,
None for older ones). Used internally by
ExecBuilder::output to populate
ExecOutcome::peak_rss_kib.