pub trait ProcessHandle: Send {
// Required methods
fn write_input(&mut self, bytes: &[u8]) -> Result<(), PtyError>;
fn resize(&mut self, size: PtySize) -> Result<(), PtyError>;
fn pause(&mut self) -> Result<(), PtyError>;
fn resume(&mut self) -> Result<(), PtyError>;
fn kill(&mut self) -> Result<(), PtyError>;
// Provided methods
fn process_id(&self) -> Option<u32> { ... }
fn terminate(
&mut self,
_signal: StopSignal,
_grace: Duration,
) -> Result<(), PtyError> { ... }
}Expand description
Handle to a spawned process: write input, resize, or terminate it.
Required Methods§
Sourcefn pause(&mut self) -> Result<(), PtyError>
fn pause(&mut self) -> Result<(), PtyError>
Suspends the process (SIGSTOP-equivalent), leaving it alive.
§Errors
Returns a PtyError if the signal cannot be sent.
Provided Methods§
Sourcefn process_id(&self) -> Option<u32>
fn process_id(&self) -> Option<u32>
The OS process ID of the spawned child, when the platform exposes it. Defaults to unknown so simple test doubles need not invent one.
Sourcefn terminate(
&mut self,
_signal: StopSignal,
_grace: Duration,
) -> Result<(), PtyError>
fn terminate( &mut self, _signal: StopSignal, _grace: Duration, ) -> Result<(), PtyError>
Requests graceful process termination with signal and grace, falling
back to Self::kill for adapters without a distinct mechanism.
§Errors
Returns a PtyError if the termination signal cannot be sent.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".