Skip to main content

ProcessHandle

Trait ProcessHandle 

Source
pub trait ProcessHandle: Send {
    // Required methods
    fn take_stdout(&mut self) -> Option<Receiver<Vec<u8>>>;
    fn take_stderr(&mut self) -> Option<Receiver<Vec<u8>>>;
    fn take_stdin(&mut self) -> Option<Sender<Vec<u8>>>;
    fn is_pty(&self) -> bool;
    fn resize_pty<'life0, 'async_trait>(
        &'life0 mut self,
        cols: u16,
        rows: u16,
    ) -> Pin<Box<dyn Future<Output = Result<(), IsolatorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn kill<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), IsolatorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn wait<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<ExitStatus, IsolatorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Uniform handle to a running CLI process — host or container.

The handle owns one set of byte channels:

  • stdout_rx / stderr_rx: lines (or chunks) emitted by the process. For PTY-allocated processes, all output flows through stdout_rx (stderr is multiplexed by the kernel).
  • stdin_tx: writes from the harness back into the process. None for processes spawned without an input channel.

All channels are tokio mpsc; the isolator background tasks translate platform-specific I/O to these channels.

Required Methods§

Source

fn take_stdout(&mut self) -> Option<Receiver<Vec<u8>>>

Take ownership of the stdout byte stream. Returns None once already taken.

Source

fn take_stderr(&mut self) -> Option<Receiver<Vec<u8>>>

Take ownership of the stderr byte stream.

Source

fn take_stdin(&mut self) -> Option<Sender<Vec<u8>>>

Take ownership of the stdin sender.

Source

fn is_pty(&self) -> bool

true if the process was spawned with a PTY (interactive).

Source

fn resize_pty<'life0, 'async_trait>( &'life0 mut self, cols: u16, rows: u16, ) -> Pin<Box<dyn Future<Output = Result<(), IsolatorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resize the PTY window. Errors with Unsupported if not a PTY process.

Source

fn kill<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), IsolatorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send SIGTERM (and SIGKILL after grace).

Source

fn wait<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<ExitStatus, IsolatorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Wait for the process to exit. Idempotent — repeated calls after exit return the cached status.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§