[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] 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.
---
 daklib/utils.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/daklib/utils.py b/daklib/utils.py
index 0896d57..5c71647 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]
-- 
1.5.6.5


Reply to: