aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2018-04-22 08:56:29 -0700
committerZac Medico <zmedico@gentoo.org>2018-04-22 10:48:52 -0700
commitd836b0d32797f1431ebeaa20e2a18ea5cb7c3f7c (patch)
treeab904b5e0b35a4b831cf3bfe074a098e8c0d6552
parenttest_iter_completed: fix max_load in testAsyncCancel (diff)
downloadportage-d836b0d32797f1431ebeaa20e2a18ea5cb7c3f7c.tar.gz
portage-d836b0d32797f1431ebeaa20e2a18ea5cb7c3f7c.tar.bz2
portage-d836b0d32797f1431ebeaa20e2a18ea5cb7c3f7c.zip
AsyncFunction: use _async_waitpid (bug 591760)
When pid exit status is not yet available, use the Subprocess _async_waitpid() method to avoid event loop recursion. Bug: https://bugs.gentoo.org/591760
-rw-r--r--pym/portage/util/_async/AsyncFunction.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage/util/_async/AsyncFunction.py b/pym/portage/util/_async/AsyncFunction.py
index 40f6c5e75..ad3d8333f 100644
--- a/pym/portage/util/_async/AsyncFunction.py
+++ b/pym/portage/util/_async/AsyncFunction.py
@@ -57,8 +57,11 @@ class AsyncFunction(ForkProcess):
# and returned an unsuccessful returncode.
pass
self._async_func_reader = None
- self._unregister()
- self.wait()
+ if self.returncode is None:
+ self._async_waitpid()
+ else:
+ self._unregister()
+ self._async_wait()
def _unregister(self):
ForkProcess._unregister(self)