debugger: Kill debug sessions on app quit (#33273)

Before this PR force quitting Zed would leave hanging debug adapter
processes and not allow debug adapters to clean up their sessions
properly.

This PR fixes this problem by sending a disconnect/terminate to all
debug adapters and force shutting down their processes after they
respond.

Co-authored-by: Cole Miller \<cole@zed.dev\>

Release Notes:

- debugger: Shutdown and clean up debug processes when force quitting
Zed

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
This commit is contained in:
Anthony Eid
2025-06-23 20:41:53 +00:00
committed by GitHub
co-authored by Conrad Irwin Remco Smits
parent c610ebfb03
commit d34d4f2ef1
6 changed files with 288 additions and 63 deletions
+3 -8
View File
@@ -163,8 +163,9 @@ impl DebugAdapterClient {
self.sequence_count.fetch_add(1, Ordering::Relaxed)
}
pub async fn shutdown(&self) -> Result<()> {
self.transport_delegate.shutdown().await
pub fn kill(&self) {
log::debug!("Killing DAP process");
self.transport_delegate.transport.lock().kill();
}
pub fn has_adapter_logs(&self) -> bool {
@@ -315,8 +316,6 @@ mod tests {
},
response
);
client.shutdown().await.unwrap();
}
#[gpui::test]
@@ -368,8 +367,6 @@ mod tests {
called_event_handler.load(std::sync::atomic::Ordering::SeqCst),
"Event handler was not called"
);
client.shutdown().await.unwrap();
}
#[gpui::test]
@@ -433,7 +430,5 @@ mod tests {
called_event_handler.load(std::sync::atomic::Ordering::SeqCst),
"Event handler was not called"
);
client.shutdown().await.unwrap();
}
}