summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/__init__.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index a22440c93..78715bad5 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -2175,6 +2175,10 @@ class SpawnProcess(SubProcess):
kwargs["returnpid"] = True
kwargs.pop("logfile", None)
+ self._reg_id = self.scheduler.register(files.process.fileno(),
+ PollConstants.POLLIN, output_handler)
+ self._registered = True
+
retval = self._spawn(self.args, **kwargs)
os.close(slave_fd)
@@ -2183,8 +2187,7 @@ class SpawnProcess(SubProcess):
if isinstance(retval, int):
# spawn failed
- for f in files.values():
- f.close()
+ self._unregister()
self.returncode = retval
self.wait()
return
@@ -2192,10 +2195,6 @@ class SpawnProcess(SubProcess):
self.pid = retval[0]
portage.process.spawned_pids.remove(self.pid)
- self._reg_id = self.scheduler.register(files.process.fileno(),
- PollConstants.POLLIN, output_handler)
- self._registered = True
-
def _pipe(self, fd_pipes):
"""
@type fd_pipes: dict
@@ -2840,6 +2839,12 @@ class EbuildMetadataPhase(SubProcess):
fd_pipes[self._metadata_fd] = slave_fd
+ self._raw_metadata = []
+ files.ebuild = os.fdopen(master_fd, 'r')
+ self._reg_id = self.scheduler.register(files.ebuild.fileno(),
+ PollConstants.POLLIN, self._output_handler)
+ self._registered = True
+
retval = portage.doebuild(ebuild_path, "depend",
settings["ROOT"], settings, debug,
mydbapi=self.portdb, tree="porttree",
@@ -2849,7 +2854,7 @@ class EbuildMetadataPhase(SubProcess):
if isinstance(retval, int):
# doebuild failed before spawning
- os.close(master_fd)
+ self._unregister()
self.returncode = retval
self.wait()
return
@@ -2857,12 +2862,6 @@ class EbuildMetadataPhase(SubProcess):
self.pid = retval[0]
portage.process.spawned_pids.remove(self.pid)
- self._raw_metadata = []
- files.ebuild = os.fdopen(master_fd, 'r')
- self._reg_id = self.scheduler.register(files.ebuild.fileno(),
- PollConstants.POLLIN, self._output_handler)
- self._registered = True
-
def _output_handler(self, fd, event):
files = self._files
self._raw_metadata.append(files.ebuild.read())