pub struct ProcessHandle { /* private fields */ }Expand description
Handle to an in-flight streaming run. Caller stores it (e.g. in a
runId-keyed map) so a later cancel() can find it.
Dropping the handle does NOT cancel the run — the reader threads +
wait thread continue independently. Use cancel() explicitly when
the user closes the connection.
Implementations§
Source§impl ProcessHandle
impl ProcessHandle
Sourcepub fn cancel(&self) -> Result<(), StreamError>
pub fn cancel(&self) -> Result<(), StreamError>
SIGTERM the process, then SIGKILL after 1.5s if it’s still alive. The CLI is supposed to flush a final result on SIGTERM but we don’t trust it to do so forever.
Sourcepub fn write_line(&self, line: &str) -> Result<(), StreamError>
pub fn write_line(&self, line: &str) -> Result<(), StreamError>
Send one line to the child’s stdin, newline-terminated and flushed.
There is only one stream a caller can write to, so the name does not
repeat it — Stdin::Piped on the command is where that was said.
Err when the child was spawned with Stdin::Closed (the default), or
when it has exited and the pipe is gone — both of which a caller
expecting an answer needs to hear about rather than block on.
Sourcepub fn write(&self, bytes: &[u8]) -> Result<(), StreamError>
pub fn write(&self, bytes: &[u8]) -> Result<(), StreamError>
Send raw bytes to the child’s stdin, flushed.
write_line covers newline-delimited protocols,
which most CLIs and MCP’s stdio transport use. This is for the ones that
frame differently — LSP counts bytes in a Content-Length header, and a
stray newline there is a protocol error.
Sourcepub fn was_cancelled(&self) -> bool
pub fn was_cancelled(&self) -> bool
Whether cancel() was called. Tagged on the final Exited event.
Trait Implementations§
Source§impl Clone for ProcessHandle
impl Clone for ProcessHandle
Source§fn clone(&self) -> ProcessHandle
fn clone(&self) -> ProcessHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProcessHandle
impl Debug for ProcessHandle
Source§impl RunControl for ProcessHandle
impl RunControl for ProcessHandle
Source§fn was_cancelled(&self) -> bool
fn was_cancelled(&self) -> bool
cancel was called.