Migrate job pgid from job to job tree

Prior to this, jobs all had a pgid, and fish has to work hard to ensure
that pgids were inherited properly for nested jobs. But now the job tree
is the source of truth and there is only one location for the pgid.
This commit is contained in:
ridiculousfish
2020-05-29 14:51:48 -07:00
parent a86d3f4136
commit f37a44db16
9 changed files with 122 additions and 130 deletions

View File

@@ -613,18 +613,10 @@ const job_t *parser_t::job_get(job_id_t id) const {
}
job_t *parser_t::job_get_from_pid(pid_t pid) const {
pid_t pgid = getpgid(pid);
if (pgid == -1) {
return nullptr;
}
for (const auto &job : jobs()) {
if (job->pgid == pgid) {
for (const process_ptr_t &p : job->processes) {
if (p->pid == pid) {
return job.get();
}
for (const process_ptr_t &p : job->processes) {
if (p->pid == pid) {
return job.get();
}
}
}