debugger: Don't spin forever when adapter disconnects unexpectedly (#32489)

Closes #ISSUE

Release Notes:

- Debugger Beta: made the debug panel UI more helpful when an invalid
configuration is sent to the debug adapter.

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Cole Miller 2025-06-10 16:26:43 -04:00 committed by GitHub
parent e62e9facf0
commit e4f8c4fb4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 8 deletions

View file

@ -1,4 +1,4 @@
use anyhow::{Context as _, Result, bail};
use anyhow::{Context as _, Result, anyhow, bail};
use dap_types::{
ErrorResponse,
messages::{Message, Response},
@ -191,7 +191,7 @@ impl TransportDelegate {
match Self::handle_output(
params.output,
client_tx,
pending_requests,
pending_requests.clone(),
output_log_handler,
)
.await
@ -199,6 +199,12 @@ impl TransportDelegate {
Ok(()) => {}
Err(e) => log::error!("Error handling debugger output: {e}"),
}
let mut pending_requests = pending_requests.lock().await;
pending_requests.drain().for_each(|(_, request)| {
request
.send(Err(anyhow!("debugger shutdown unexpectedly")))
.ok();
});
}));
if let Some(stderr) = params.stderr.take() {