Skip to main content

MxcProcess

Struct MxcProcess 

Source
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

Source

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.

Source

pub fn output_metadata(&self) -> Option<&ExecutionMetadata>

Structured outputs available after a terminal wait completes.

Source

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.

Source

pub fn take_stdout(&mut self) -> Option<Box<dyn Read + Send>>

Take the child’s stdout pipe. Returns None after the first call.

Source

pub fn take_stderr(&mut self) -> Option<Box<dyn Read + Send>>

Take the child’s stderr pipe. Returns None after the first call.

Source

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.

Source

pub fn stderr_closer(&self) -> Option<StreamCloser>

As stdout_closer, for stderr.

Source

pub fn try_wait(&mut self) -> Result<Option<i32>>

Non-blocking exit check: Some(code) if the child has exited.

Source

pub fn try_wait_detailed(&mut self) -> Result<Option<WaitResult>, Error>

Non-blocking terminal check that preserves structured backend failures.

Source

pub fn id(&self) -> u32

The child’s process id.

Source

pub fn kill(&mut self) -> Result<()>

Kill the child.

Source

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.

Source

pub fn wait_detailed(&mut self) -> Result<WaitResult, Error>

Wait for the child to finish while preserving structured backend failures.

Source

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.

Source

pub fn wait_with_output_detailed(self) -> Result<ExecutionResult, Error>

Capture stdout and stderr while preserving structured backend wait failures.

Auto Trait Implementations§

§

impl !RefUnwindSafe for MxcProcess

§

impl !Sync for MxcProcess

§

impl !UnwindSafe for MxcProcess

§

impl Forget for MxcProcess

§

impl Freeze for MxcProcess
where *const dyn SandboxProcess is !null: Freeze, PhantomData<dyn SandboxProcess>: Freeze,

§

impl Move for MxcProcess

§

impl Send for MxcProcess
where BoxRaw<dyn SandboxProcess>: Send,

§

impl Unpin for MxcProcess
where Box<dyn SandboxProcess>: Unpin,

§

impl UnsafeUnpin for MxcProcess
where *const dyn SandboxProcess is !null: UnsafeUnpin, PhantomData<dyn SandboxProcess>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.