From 8f77b1cdd24888084d1e72b2ce2cffc39ef54d12 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 23 Apr 2017 22:12:13 +0800 Subject: [PATCH] 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. --- src/postfork.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postfork.cpp b/src/postfork.cpp index 96e38443d..01ed1f7c6 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -101,7 +101,7 @@ bool set_child_group(job_t *j, process_t *p, int print_errors) { } } } else { - j->pgid = getpid(); + j->pgid = getpgrp(); } if (j->get_flag(JOB_TERMINAL) && j->get_flag(JOB_FOREGROUND)) { //!OCLINT(early exit)