fix stale process count after interrupt
Don't abort the tokio task when killing processes — let SIGTERM'd processes exit normally so run_bash sees the exit and unregisters them from the tracker. Only abort the turn when no processes are running (e.g. interrupting a streaming response). Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
ef7dd59b7e
commit
a360607fad
1 changed files with 12 additions and 8 deletions
|
|
@ -547,14 +547,18 @@ impl Session {
|
||||||
for p in &procs {
|
for p in &procs {
|
||||||
self.process_tracker.kill(p.pid).await;
|
self.process_tracker.kill(p.pid).await;
|
||||||
}
|
}
|
||||||
if let Some(handle) = self.turn_handle.take() {
|
// Only abort the turn if no processes are running — let SIGTERM'd
|
||||||
handle.abort();
|
// processes exit normally so run_bash can unregister them.
|
||||||
self.turn_in_progress = false;
|
if procs.is_empty() {
|
||||||
self.dmn = dmn::State::Resting {
|
if let Some(handle) = self.turn_handle.take() {
|
||||||
since: Instant::now(),
|
handle.abort();
|
||||||
};
|
self.turn_in_progress = false;
|
||||||
self.update_status();
|
self.dmn = dmn::State::Resting {
|
||||||
let _ = self.ui_tx.send(UiMessage::Activity(String::new()));
|
since: Instant::now(),
|
||||||
|
};
|
||||||
|
self.update_status();
|
||||||
|
let _ = self.ui_tx.send(UiMessage::Activity(String::new()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.pending_input = None;
|
self.pending_input = None;
|
||||||
let killed = procs.len();
|
let killed = procs.len();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue