1 |
commit: 97587a47fcd00d070c081ad3933e4036cf0f8e81 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Mar 1 19:28:33 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Mar 1 20:30:42 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=97587a47 |
7 |
|
8 |
SpawnProcess: cancel _main_task in _unregister (bug 711174) |
9 |
|
10 |
Cancel _main_task in _unregister, in order to ensure that the build |
11 |
log is properly closed. Note that is analogous to the fix for bug |
12 |
658806 in commit a9a62e57194c, but behavior related to coroutine |
13 |
cancellation now plays a role since the PipeLogger is now cancelled |
14 |
indirectly via _main_task. We still need to verify that coroutine |
15 |
cancellation will raise an appropriate exception in the coroutine |
16 |
(asyncio.CancelledError, GeneratorExit, or StopIteration) and also |
17 |
that the specific coroutine will react appropriately to the |
18 |
specific exception that will be raised. |
19 |
|
20 |
Fixes: 8074127bbc21 ("SpawnProcess: add _main coroutine") |
21 |
Bug: https://bugs.gentoo.org/711174 |
22 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
23 |
|
24 |
lib/_emerge/SpawnProcess.py | 2 ++ |
25 |
1 file changed, 2 insertions(+) |
26 |
|
27 |
diff --git a/lib/_emerge/SpawnProcess.py b/lib/_emerge/SpawnProcess.py |
28 |
index 34668b287..bf5c45189 100644 |
29 |
--- a/lib/_emerge/SpawnProcess.py |
30 |
+++ b/lib/_emerge/SpawnProcess.py |
31 |
@@ -218,6 +218,8 @@ class SpawnProcess(SubProcess): |
32 |
if self.cgroup is not None: |
33 |
self._cgroup_cleanup() |
34 |
self.cgroup = None |
35 |
+ if self._main_task is not None: |
36 |
+ self._main_task.done() or self._main_task.cancel() |
37 |
|
38 |
def _cancel(self): |
39 |
SubProcess._cancel(self) |