Skip to content

Commit

Permalink
SpawnProcess: cancel _main_task in _unregister (bug 711174)
Browse files Browse the repository at this point in the history
Cancel _main_task in _unregister, in order to ensure that the build
log is properly closed. Note that is analogous to the fix for bug
658806 in commit a9a62e5, but behavior related to coroutine
cancellation now plays a role since the PipeLogger is now cancelled
indirectly via _main_task. We still need to verify that coroutine
cancellation will raise an appropriate exception in the coroutine
(asyncio.CancelledError, GeneratorExit, or StopIteration) and also
that the specific coroutine will react appropriately to the
specific exception that will be raised.

Fixes: 8074127 ("SpawnProcess: add _main coroutine")
Bug: https://bugs.gentoo.org/711174
Signed-off-by: Zac Medico <zmedico@gentoo.org>
  • Loading branch information
zmedico committed Mar 1, 2020
1 parent d4d1c31 commit 97587a4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/_emerge/SpawnProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ def _unregister(self):
if self.cgroup is not None:
self._cgroup_cleanup()
self.cgroup = None
if self._main_task is not None:
self._main_task.done() or self._main_task.cancel()

def _cancel(self):
SubProcess._cancel(self)
Expand Down

0 comments on commit 97587a4

Please sign in to comment.