diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_emerge/SubProcess.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/_emerge/SubProcess.py b/lib/_emerge/SubProcess.py index 7d6b03272..1ddfe57fd 100644 --- a/lib/_emerge/SubProcess.py +++ b/lib/_emerge/SubProcess.py @@ -1,10 +1,11 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import logging from portage import os from portage.util import writemsg_level +from portage.util.futures import asyncio from _emerge.AbstractPollTask import AbstractPollTask import signal import errno @@ -40,6 +41,14 @@ class SubProcess(AbstractPollTask): return self.pid is not None and \ self.returncode is None + def _async_wait(self): + if self.returncode is None: + raise asyncio.InvalidStateError('Result is not ready for %s' % (self,)) + else: + # This calls _unregister, so don't call it until pid status + # is available. + super(SubProcess, self)._async_wait() + def _async_waitpid(self): """ Wait for exit status of self.pid asynchronously, and then |