aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo
diff options
context:
space:
mode:
Diffstat (limited to 'MgaRepo')
-rw-r--r--MgaRepo/util.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/MgaRepo/util.py b/MgaRepo/util.py
index ff71ce7..9008a59 100644
--- a/MgaRepo/util.py
+++ b/MgaRepo/util.py
@@ -71,11 +71,17 @@ def execcmd(*cmd, **kwargs):
sys.stdout.write(data)
output = error.getvalue()
else:
- proc.wait()
- if proc.stdout is not None:
- output = proc.stdout.read().decode('utf8')
- if kwargs.get("strip", True):
- output = output.rstrip()
+ # Make sure to avoid buffer getting full.
+ # Otherwise if ie. using proc.wait() both python
+ # and the process will just hang
+ while proc.poll() is None:
+ if proc.stdout is not None:
+ output += proc.stdout.read(8192).decode('utf8')
+ # Make sure that we've emptied the buffer entirely
+ output += proc.stdout.read().decode('utf8')
+
+ if kwargs.get("strip", True):
+ output = output.rstrip()
if (not kwargs.get("noerror")) and proc.returncode != 0:
if kwargs.get("cleanerr"):