From: Chris Lamb Date: Wed, 7 Jul 2010 13:22:44 +0000 (+0100) Subject: Fix race condition in our commands.getstatusoutput monkeypatch X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=1d51baf77090bae1afb98016831a95c9b050ae2e;p=dak.git Fix race condition in our commands.getstatusoutput monkeypatch 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. --- diff --git a/daklib/utils.py b/daklib/utils.py index 0896d578..5c716470 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -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]