Skip to main content

PtyChild

Trait PtyChild 

Source
pub trait PtyChild: Send + Sync {
    // Required methods
    fn pid(&self) -> u32;
    fn is_running(&self) -> bool;
    fn wait(
        &mut self,
    ) -> Pin<Box<dyn Future<Output = Result<ExitStatus>> + Send + '_>>;
    fn try_wait(&mut self) -> Result<Option<ExitStatus>>;
    fn signal(&self, signal: PtySignal) -> Result<()>;
    fn kill(&mut self) -> Result<()>;
}
Expand description

Handle for a child process spawned in a PTY.

This trait provides methods for monitoring and controlling the child process. It’s separate from PtyMaster to allow independent lifetime management of the PTY and the process.

Required Methods§

Source

fn pid(&self) -> u32

Get the process ID of the child.

Source

fn is_running(&self) -> bool

Check if the child process is still running.

Source

fn wait( &mut self, ) -> Pin<Box<dyn Future<Output = Result<ExitStatus>> + Send + '_>>

Wait for the child process to exit.

Returns the exit status when the process terminates.

Source

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

Try to get the exit status without blocking.

Returns None if the process is still running.

Source

fn signal(&self, signal: PtySignal) -> Result<()>

Send a signal to the child process.

Source

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

Kill the child process.

This sends SIGKILL on Unix or calls TerminateProcess on Windows.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§