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:
parent
970a1066f5
commit
8f6b9f0d65
5 changed files with 156 additions and 79 deletions
|
@ -121,6 +121,10 @@ impl PtyProcessInfo {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn kill_current_process(&mut self) -> bool {
|
||||
self.refresh().map_or(false, |process| process.kill())
|
||||
}
|
||||
|
||||
fn load(&mut self) -> Option<ProcessInfo> {
|
||||
let process = self.refresh()?;
|
||||
let cwd = process.cwd().map_or(PathBuf::new(), |p| p.to_owned());
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue