1 |
commit: fc78181d856ef0ecf6fa21262cc87fe71426d8e3 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Nov 21 19:12:20 2015 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 23 16:27:28 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=fc78181d |
7 |
|
8 |
SpawnProcess: make _cancel kill all processes in cgroup (bug 566414) |
9 |
|
10 |
Since the _cancel method is used to kill subprocesses after die is |
11 |
called, this fixes die calls in subshells to kill all processes in |
12 |
the cgroup. For example, see the test ebuild attached to bug 465008, |
13 |
which would hang for 60 seconds after die was called as follows: |
14 |
|
15 |
sleep 60 | ( false || die ) |
16 |
|
17 |
X-Gentoo-Bug: 566414 |
18 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=566414 |
19 |
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org> |
20 |
|
21 |
pym/_emerge/SpawnProcess.py | 6 ++++++ |
22 |
1 file changed, 6 insertions(+) |
23 |
|
24 |
diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py |
25 |
index 5ab2e67..b4b4b5b 100644 |
26 |
--- a/pym/_emerge/SpawnProcess.py |
27 |
+++ b/pym/_emerge/SpawnProcess.py |
28 |
@@ -179,7 +179,13 @@ class SpawnProcess(SubProcess): |
29 |
|
30 |
def _set_returncode(self, wait_retval): |
31 |
SubProcess._set_returncode(self, wait_retval) |
32 |
+ self._cgroup_cleanup() |
33 |
|
34 |
+ def _cancel(self): |
35 |
+ SubProcess._cancel(self) |
36 |
+ self._cgroup_cleanup() |
37 |
+ |
38 |
+ def _cgroup_cleanup(self): |
39 |
if self.cgroup: |
40 |
def get_pids(cgroup): |
41 |
try: |