Use Popen.communicate() to avoid a potential deadlock.
authorZac Medico <zmedico@gentoo.org>
Fri, 27 Feb 2009 05:23:37 +0000 (05:23 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 27 Feb 2009 05:23:37 +0000 (05:23 -0000)
svn path=/main/trunk/; revision=12729

pym/portage/sets/shell.py

index 8114b5133f0db3b1af168f907fb54d7a3628bb6d..43a8fe02f722e145eaa3c5fe42cca3c53aee7511 100644 (file)
@@ -33,9 +33,9 @@ class CommandOutputSet(PackageSet):
        
        def load(self):
                pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, shell=True)
+               stdout, stderr = pipe.communicate()
                if pipe.wait() == os.EX_OK:
-                       text = unicode(pipe.stdout.read(), errors='replace')
-                       self._setAtoms(text.splitlines())
+                       self._setAtoms(unicode(stdout, errors='replace').splitlines())
 
        def singleBuilder(self, options, settings, trees):
                if not "command" in options: