For subshell die support (bug 465008), we need to re-check cgroup.procs
until it's empty, in case any of the listed processes fork before we've
had a chance to kill them.

X-Gentoo-Bug: 566420
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=566420
---
 pym/_emerge/SpawnProcess.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py
index 5ab2e67..b27be2f 100644
--- a/pym/_emerge/SpawnProcess.py
+++ b/pym/_emerge/SpawnProcess.py
@@ -203,10 +203,13 @@ class SpawnProcess(SubProcess):
                                                elif e.errno != errno.ESRCH:
                                                        raise
 
-                       # step 1: kill all orphans
-                       pids = get_pids(self.cgroup)
-                       if pids:
-                               kill_all(pids, signal.SIGKILL)
+                       # step 1: kill all orphans (loop in case of new forks)
+                       while True:
+                               pids = get_pids(self.cgroup)
+                               if pids:
+                                       kill_all(pids, signal.SIGKILL)
+                               else:
+                                       break
 
                        # step 2: remove the cgroup
                        try:
-- 
2.4.9


Reply via email to