aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/_emerge/AsynchronousTask.py8
-rw-r--r--lib/portage/tests/util/futures/test_done_callback_after_exit.py4
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py
index 97db02587..ec5497b69 100644
--- a/lib/_emerge/AsynchronousTask.py
+++ b/lib/_emerge/AsynchronousTask.py
@@ -156,6 +156,10 @@ class AsynchronousTask(SlotObject):
self._start_listeners = []
self._start_listeners.append(f)
+ # Ensure that start listeners are always called.
+ if self.returncode is not None:
+ self._start_hook()
+
def removeStartListener(self, f):
if self._start_listeners is None:
return
@@ -198,6 +202,10 @@ class AsynchronousTask(SlotObject):
used to trigger exit listeners when the returncode first
becomes available.
"""
+ # Ensure that start listeners are always called.
+ if self.returncode is not None:
+ self._start_hook()
+
if self.returncode is not None and \
self._exit_listeners is not None:
diff --git a/lib/portage/tests/util/futures/test_done_callback_after_exit.py b/lib/portage/tests/util/futures/test_done_callback_after_exit.py
index 46a51c271..8913d70e5 100644
--- a/lib/portage/tests/util/futures/test_done_callback_after_exit.py
+++ b/lib/portage/tests/util/futures/test_done_callback_after_exit.py
@@ -36,5 +36,9 @@ class DoneCallbackAfterExitTestCase(TestCase):
for i in range(3):
event = loop.create_future()
+ task.addStartListener(lambda task: event.set_result(None))
+ loop.run_until_complete(event)
+
+ event = loop.create_future()
task.addExitListener(lambda task: event.set_result(None))
loop.run_until_complete(event)