fix: clear jobs _after_ traversing jobs for kill_all (#15685)

# Description

Move clear jobs to _after_ traversing them, in order to kill them.

# User-Facing Changes

None

# Tests + Formatting

It looks like it's only used once, in crates/nu-engine/src/exit.rs
This commit is contained in:
Andy Gayton 2025-05-07 05:25:16 -04:00 committed by GitHub
parent ff8831318d
commit 583cb96cff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,13 +112,13 @@ impl Jobs {
pub fn kill_all(&mut self) -> std::io::Result<()> {
self.last_frozen_job_id = None;
self.jobs.clear();
let first_err = self
.iter()
.map(|(_, job)| job.kill().err())
.fold(None, |acc, x| acc.or(x));
self.jobs.clear();
if let Some(err) = first_err {
Err(err)
} else {