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 16:41:53 -04:00 committed by GitHub
parent c610ebfb03
commit d34d4f2ef1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 288 additions and 63 deletions

View file

@ -701,6 +701,16 @@ impl RunningState {
BreakpointList::new(Some(session.clone()), workspace.clone(), &project, cx);
let _subscriptions = vec![
cx.on_app_quit(move |this, cx| {
let shutdown = this
.session
.update(cx, |session, cx| session.on_app_quit(cx));
let terminal = this.debug_terminal.clone();
async move {
shutdown.await;
drop(terminal)
}
}),
cx.observe(&module_list, |_, _, cx| cx.notify()),
cx.subscribe_in(&session, window, |this, _, event, window, cx| {
match event {