Render error state when agent binary exits unexpectedly (#35651)
This PR adds handling for the case where an agent binary exits unexpectedly after successfully establishing a connection. Release Notes: - N/A --------- Co-authored-by: Agus <agus@zed.dev>
This commit is contained in:
parent
142efbac0d
commit
bc2108cbba
5 changed files with 116 additions and 35 deletions
|
@ -61,11 +61,24 @@ impl AcpConnection {
|
|||
}
|
||||
});
|
||||
|
||||
let io_task = cx.background_spawn(async move {
|
||||
io_task.await?;
|
||||
drop(child);
|
||||
Ok(())
|
||||
});
|
||||
let io_task = cx.background_spawn(io_task);
|
||||
|
||||
cx.spawn({
|
||||
let sessions = sessions.clone();
|
||||
async move |cx| {
|
||||
let status = child.status().await?;
|
||||
|
||||
for session in sessions.borrow().values() {
|
||||
session
|
||||
.thread
|
||||
.update(cx, |thread, cx| thread.emit_server_exited(status, cx))
|
||||
.ok();
|
||||
}
|
||||
|
||||
anyhow::Ok(())
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
let response = connection
|
||||
.initialize(acp::InitializeRequest {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue