pub struct ChildConnection { /* private fields */ }Expand description
An initialized Client connection that owns and supervises its stdio child.
The incoming protocol driver and stderr drain run as soon as this value is
returned. Call Self::server for typed traffic, Self::shutdown for a
complete graceful lifecycle, or Self::wait when the child is expected
to end by itself. Dropping the connection starts a reaper thread that uses
Tokio for graceful cleanup when available and always retains a synchronous
kill-and-reap fallback across runtime shutdown. Without a current runtime,
Drop performs that fallback synchronously.
Implementations§
Source§impl ChildConnection
impl ChildConnection
Sourcepub fn server(&self) -> ServerHandle
pub fn server(&self) -> ServerHandle
Clone the typed handle used to communicate with the child server.
Sourcepub async fn shutdown(self) -> Result<ChildOutput, ChildError>
pub async fn shutdown(self) -> Result<ChildOutput, ChildError>
Complete shutdown followed by exit, then reap the child.
Cleanup still disconnects and reclaims the process if either lifecycle operation fails.
Sourcepub async fn wait(self) -> Result<ChildOutput, ChildError>
pub async fn wait(self) -> Result<ChildOutput, ChildError>
Wait for a child that is expected to terminate without local cleanup.
The process is still reaped and the protocol driver and stderr drain are joined before this future resolves.