Fix SpawnProcess.start() to return early and notify exit listeners if the
authorZac Medico <zmedico@gentoo.org>
Fri, 11 Jul 2008 22:40:26 +0000 (22:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 11 Jul 2008 22:40:26 +0000 (22:40 -0000)
spawn call fails.

svn path=/main/trunk/; revision=11019

pym/_emerge/__init__.py

index bde6d5cbee0606cbca7693caa6712d8ab2f9f6de..ff5c3d585457afa5aeda3582bc31a0cf403a55cd 100644 (file)
@@ -1861,10 +1861,19 @@ class SpawnProcess(SubProcess):
 
                retval = portage.process.spawn(self.args, **kwargs)
 
+               os.close(slave_fd)
+
+               if isinstance(retval, int):
+                       # spawn failed
+                       os.close(master_fd)
+                       self.returncode = retval
+                       self.wait()
+                       return
+
                self.pid = retval[0]
                portage.process.spawned_pids.remove(self.pid)
 
-               os.close(slave_fd)
+               
                files.process = os.fdopen(master_fd, 'r')
                self._reg_id = self.scheduler.register(files.process.fileno(),
                        PollConstants.POLLIN, output_handler)