use current PGID (not PID) for new processes when job control is off

If fish is not the first process in a pipeline, and jobs are started
from the fish process, it is possible for fish and the OS to have
different ideas about what the process group of the jobs are.

This change confirms the current PGID, rather than assuming that it is
the same as the PID.
This commit is contained in:
David Adam 2017-04-23 22:12:13 +08:00
parent 10e64fd548
commit 8f77b1cdd2

View File

@ -101,7 +101,7 @@ bool set_child_group(job_t *j, process_t *p, int print_errors) {
} }
} }
} else { } else {
j->pgid = getpid(); j->pgid = getpgrp();
} }
if (j->get_flag(JOB_TERMINAL) && j->get_flag(JOB_FOREGROUND)) { //!OCLINT(early exit) if (j->get_flag(JOB_TERMINAL) && j->get_flag(JOB_FOREGROUND)) { //!OCLINT(early exit)