pub struct MxcProcess { /* private fields */ }Expand description
A live container process, returned by spawn
and spawn_in_container.
Stream the child’s stdio with the take_* accessors, wait for it, or kill
it. No pty is allocated; the streams are ordinary pipes. Any stdout/stderr
the caller does not take_* is drained and discarded by wait.
Implementations§
Source§impl MxcProcess
impl MxcProcess
Sourcepub fn warnings(&self) -> Vec<String>
pub fn warnings(&self) -> Vec<String>
Policy and operational warnings from this container, such as security warnings, network rules that cannot carry traffic, or a cleanup step that failed after the workload exited.
Sourcepub fn output_metadata(&self) -> Option<&ExecutionMetadata>
pub fn output_metadata(&self) -> Option<&ExecutionMetadata>
Structured outputs available after a terminal wait completes.
Sourcepub fn take_stdin(&mut self) -> Option<Box<dyn Write + Send>>
pub fn take_stdin(&mut self) -> Option<Box<dyn Write + Send>>
Take the child’s stdin pipe; on WSLC, dropping it gives the child end-of-file.
Returns None after the first call.
Sourcepub fn take_stdout(&mut self) -> Option<Box<dyn Read + Send>>
pub fn take_stdout(&mut self) -> Option<Box<dyn Read + Send>>
Take the child’s stdout pipe. Returns None after the first call.
Sourcepub fn take_stderr(&mut self) -> Option<Box<dyn Read + Send>>
pub fn take_stderr(&mut self) -> Option<Box<dyn Read + Send>>
Take the child’s stderr pipe. Returns None after the first call.
Sourcepub fn stdout_closer(&self) -> Option<StreamCloser>
pub fn stdout_closer(&self) -> Option<StreamCloser>
A StreamCloser that unblocks a parked blocking read on stdout without
killing the child. None if stdout was not piped.
Sourcepub fn stderr_closer(&self) -> Option<StreamCloser>
pub fn stderr_closer(&self) -> Option<StreamCloser>
As stdout_closer, for stderr.
Sourcepub fn try_wait(&mut self) -> Result<Option<i32>>
pub fn try_wait(&mut self) -> Result<Option<i32>>
Non-blocking exit check: Some(code) if the child has exited.
Sourcepub fn try_wait_detailed(&mut self) -> Result<Option<WaitResult>, Error>
pub fn try_wait_detailed(&mut self) -> Result<Option<WaitResult>, Error>
Non-blocking terminal check that preserves structured backend failures.
Sourcepub fn wait(&mut self) -> Result<WaitResult>
pub fn wait(&mut self) -> Result<WaitResult>
Wait for the child to exit, draining and discarding any untaken stdout/stderr so it can’t block on a full pipe. On WSLC, it also closes a stdin the caller did not take, so the child reads end-of-file.
Returns WaitResult::Exited with the exit code, or
WaitResult::TimedOut if the request’s scriptTimeout elapsed. Err
is reserved for an actual OS / wait failure.
Sourcepub fn wait_detailed(&mut self) -> Result<WaitResult, Error>
pub fn wait_detailed(&mut self) -> Result<WaitResult, Error>
Wait for the child to finish while preserving structured backend failures.
Sourcepub fn wait_with_output(self) -> Result<ExecutionResult>
pub fn wait_with_output(self) -> Result<ExecutionResult>
Wait for the child to exit, capturing its stdout and stderr.
The safe alternative to take_stdout +
take_stderr: it drains both streams concurrently
on separate threads, so an output-heavy child can’t deadlock (reading one
stream to EOF before the other can). Consumes the handle.
Err reports an OS / wait or output-read failure; a timeout is reported
as ExecutionResult with outcome: WaitResult::TimedOut and whatever each
stream captured before cancellation. Timeout and wait failures cancel
outstanding reads so descendants retaining pipe ends cannot block capture.
Sourcepub fn wait_with_output_detailed(self) -> Result<ExecutionResult, Error>
pub fn wait_with_output_detailed(self) -> Result<ExecutionResult, Error>
Capture stdout and stderr while preserving structured backend wait failures.