debugger: Allow users to shutdown debug sessions while they're booting (#34362)

This solves problems where users couldn't shut down sessions while
locators or build tasks are running.

I renamed `debugger::Session::Mode` enum to `SessionState` to be more
clear when it's referenced in other crates. I also embedded the boot
task that is created in `SessionState::Building` variant. This allows
sessions to shut down all created threads in their boot process in a
clean and idiomatic way.

Finally, I added a method on terminal that allows killing the active
task.

Release Notes:

- Debugger: Allow shutting down debug sessions while they're booting up
This commit is contained in:
Anthony Eid 2025-07-12 19:16:35 -04:00 committed by GitHub
parent 970a1066f5
commit 8f6b9f0d65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 156 additions and 79 deletions

View file

@ -1824,6 +1824,14 @@ impl Terminal {
}
}
pub fn kill_active_task(&mut self) {
if let Some(task) = self.task() {
if task.status == TaskStatus::Running {
self.pty_info.kill_current_process();
}
}
}
pub fn task(&self) -> Option<&TaskState> {
self.task.as_ref()
}