INNER CODE UNIT · Rust

launch_transport

xuzhougeng/wisp-science · crates/wisp-acp/src/lib.rs:418

async fn launch_transport(
    process: impl ConnectTo<Client>,
    stderr: BoundedStderr,
) -> Result<AcpSessionHandle, AcpError> {
    let (command_tx, command_rx) = mpsc::unbounded_channel();
    let (event_tx, event_rx) = mpsc::unbounded_channel();
    let (ready_tx, ready_rx) = oneshot::channel();
    let mut actor = LaunchActor(Some(tokio::spawn(async move {
        let result = run_actor(process, command_rx, event_tx.clone(), ready_tx).await;
        let _ = event_tx.send(AcpSessionEvent::Exited {
            error: result.err().map(|error| error.to_string()),
        });
    })));

    let info = match ready_rx.await {
        Ok(result) => result?,
        Err(_) => {
            // The process waiter and stderr reader finish independently, so a

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…