pub trait ConnInterface: Send + Sync {
// Required methods
fn start(&mut self) -> Result<()>;
fn wait(&mut self) -> Result<i32>;
fn kill(&self) -> Result<()>;
fn kill_graceful(&self, timeout_ms: u64) -> Result<()>;
fn exit_code(&self) -> i32;
fn write_data(&self, data: &[u8]) -> Result<usize>;
fn read_data(&self, buf: &mut [u8]) -> Result<usize>;
fn set_size(&self, rows: i64, cols: i64) -> Result<()>;
fn close(&self) -> Result<()>;
}Expand description
Abstraction over a PTY-connected process.
Port of Go’s shellexec.ConnInterface which embeds pty.Pty.
The only implementation is MockConn (testing). The production shell
path (blockcontroller/shell/lifecycle.rs) opens its PTY directly via
portable_pty; it uses this trait only when a test installs a
conn_factory.
Required Methods§
Sourcefn kill_graceful(&self, timeout_ms: u64) -> Result<()>
fn kill_graceful(&self, timeout_ms: u64) -> Result<()>
Kill the process gracefully with a timeout.
Sourcefn write_data(&self, data: &[u8]) -> Result<usize>
fn write_data(&self, data: &[u8]) -> Result<usize>
Write data to process stdin/PTY.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".