]> git.decadent.org.uk Git - dak.git/commitdiff
Fix race condition in our commands.getstatusoutput monkeypatch
authorChris Lamb <lamby@debian.org>
Wed, 7 Jul 2010 13:22:44 +0000 (14:22 +0100)
committerChris Lamb <lamby@debian.org>
Wed, 7 Jul 2010 13:22:44 +0000 (14:22 +0100)
Previously we were returning from this method before the process had actually
finished, introducing issues where we relied on process actually finishing or
simply not returning all the data the process was going to produce.

daklib/utils.py

index 0896d57839eb335f30f375a602519cb727deb15c..5c7164705ee4147fe7f07c67d1adf0180e438cea 100755 (executable)
@@ -70,7 +70,7 @@ def dak_getstatusoutput(cmd):
     pipe = subprocess.Popen(cmd, shell=True, universal_newlines=True,
         stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 
-    output = "".join(pipe.stdout.readlines())
+    output, _ = pipe.communicate()
 
     if output[-1:] == '\n':
         output = output[:-1]