mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-28 13:11:15 -03:00
Rationalize background-in-background procs
If a background process runs a fish function which launches another background process, ensure that these background procs get different pgroups. Add a test for it.
This commit is contained in:
@@ -59,9 +59,10 @@ pgroup_provenance_t get_pgroup_provenance(const shared_ptr<job_t> &j,
|
||||
bool has_external = j->has_external_proc();
|
||||
assert(first_proc_is_internal ? has_internal : has_external);
|
||||
|
||||
if (lineage.parent_pgid.has_value()) {
|
||||
if (lineage.parent_pgid.has_value() && j->is_foreground()) {
|
||||
// Our lineage indicates a pgid. This means the job is "nested" as a function or block
|
||||
// inside another job, which has a real pgroup. We're going to use that.
|
||||
// inside another job, which has a real pgroup. We're going to use that, unless it's
|
||||
// backgrounded, in which case it should not inherit a pgroup.
|
||||
return pgroup_provenance_t::lineage;
|
||||
} else if (!j->wants_job_control()) {
|
||||
// This job doesn't need job control, it can just live in the fish pgroup.
|
||||
|
||||
Reference in New Issue
Block a user