aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-06-23 22:11:53 -0700
committerZac Medico <zmedico@gentoo.org>2020-06-23 22:30:54 -0700
commitac9184e0b0445a9294ae47f71abe7117799a4577 (patch)
treecb049dee6fc81ebd579f641357e1815a6c6e830a /lib/_emerge
parentPipeLogger._unregister: sanity check for closed file or loop (diff)
downloadportage-ac9184e0b0445a9294ae47f71abe7117799a4577.tar.gz
portage-ac9184e0b0445a9294ae47f71abe7117799a4577.tar.bz2
portage-ac9184e0b0445a9294ae47f71abe7117799a4577.zip
SpawnProcess._async_wait: allow _main_task to exit normally
Unnecessary cancellation of _main_task triggered this ResourceWarning for the ebuild(1) fetch command, since it prevented cleanup of BuildLogger's internal PipeLogger instance: sys:1: ResourceWarning: unclosed file <_io.FileIO name=10 mode='rb' closefd=True> Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/_emerge')
-rw-r--r--lib/_emerge/SpawnProcess.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/_emerge/SpawnProcess.py b/lib/_emerge/SpawnProcess.py
index f96911571..60239a65a 100644
--- a/lib/_emerge/SpawnProcess.py
+++ b/lib/_emerge/SpawnProcess.py
@@ -172,12 +172,23 @@ class SpawnProcess(SubProcess):
raise
def _main_exit(self, main_task):
+ self._main_task = None
try:
main_task.result()
except asyncio.CancelledError:
self.cancel()
self._async_waitpid()
+ def _async_wait(self):
+ # Allow _main_task to exit normally rather than via cancellation.
+ if self._main_task is None:
+ super(SpawnProcess, self)._async_wait()
+
+ def _async_waitpid(self):
+ # Allow _main_task to exit normally rather than via cancellation.
+ if self._main_task is None:
+ super(SpawnProcess, self)._async_waitpid()
+
def _can_log(self, slave_fd):
return True