Skip to content

Commit 8676dc9

Browse files
committed
Update ID of first background job
The job ID of the first background job is now 1, this reflects PIDs a bit better, so one can refer to the main thread as being job 0.
1 parent c0d7b38 commit 8676dc9

File tree

1 file changed

+10
-1
lines changed
  • crates/nu-protocol/src/engine

1 file changed

+10
-1
lines changed

crates/nu-protocol/src/engine/jobs.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ use crate::Signals;
99

1010
use super::JobId;
1111

12-
#[derive(Default)]
1312
pub struct Jobs {
1413
next_job_id: JobId,
1514
last_frozen_job_id: Option<JobId>,
1615
jobs: HashMap<JobId, Job>,
1716
}
1817

18+
impl Default for Jobs {
19+
fn default() -> Self {
20+
Self {
21+
next_job_id: 1,
22+
last_frozen_job_id: None,
23+
jobs: HashMap::default()
24+
}
25+
}
26+
}
27+
1928
impl Jobs {
2029
pub fn iter(&self) -> impl Iterator<Item = (JobId, &Job)> {
2130
self.jobs.iter().map(|(k, v)| (*k, v))

0 commit comments

Comments
 (0)