mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-02 02:41:15 -03:00
Be less aggressive about reclaiming the foreground pgrp
Prior to this fix, in every call to job_continue, fish would reclaim the foreground pgrp. This would cause other jobs in the pipeline (which may have another pgrp) to receive SIGTTIN / SIGTTOU. Only reclaim the foreground pgrp if it was held at the point of job_continue. This partially addresses #5765
This commit is contained in:
@@ -1021,6 +1021,9 @@ bool exec_job(parser_t &parser, shared_ptr<job_t> j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check to see if we should reclaim the foreground pgrp after the job finishes or stops.
|
||||
const bool reclaim_foreground_pgrp = (tcgetpgrp(STDIN_FILENO) == getpgrp());
|
||||
|
||||
const std::shared_ptr<job_t> parent_job = j->get_parent();
|
||||
|
||||
// Perhaps inherit our parent's pgid and job control flag.
|
||||
@@ -1120,7 +1123,7 @@ bool exec_job(parser_t &parser, shared_ptr<job_t> j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
j->continue_job(false);
|
||||
j->continue_job(reclaim_foreground_pgrp, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user