summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/process.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/process.py')
-rw-r--r--bitbake/lib/bb/process.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/bitbake/lib/bb/process.py b/bitbake/lib/bb/process.py
index dc97e3f72f..0e19cbe8de 100644
--- a/bitbake/lib/bb/process.py
+++ b/bitbake/lib/bb/process.py
@@ -63,23 +63,26 @@ class Popen(subprocess.Popen):
63 subprocess.Popen.__init__(self, *args, **options) 63 subprocess.Popen.__init__(self, *args, **options)
64 64
65def _logged_communicate(pipe, log, input): 65def _logged_communicate(pipe, log, input):
66 if pipe.stdin:
67 if input is not None:
68 pipe.stdin.write(input)
69 pipe.stdin.close()
70
66 bufsize = 512 71 bufsize = 512
67 hasoutput = pipe.stdout is not None or pipe.stderr is not None 72 outdata, errdata = [], []
68 if hasoutput: 73 while pipe.poll() is None:
69 outdata, errdata = [], [] 74 if pipe.stdout is not None:
70 while pipe.poll() is None: 75 data = pipe.stdout.read(bufsize)
71 if pipe.stdout is not None: 76 if data is not None:
72 data = pipe.stdout.read(bufsize) 77 outdata.append(data)
73 if data is not None: 78 log.write(data)
74 outdata.append(data) 79
75 log.write(data) 80 if pipe.stderr is not None:
76 81 data = pipe.stderr.read(bufsize)
77 if pipe.stderr is not None: 82 if data is not None:
78 data = pipe.stderr.read(bufsize) 83 errdata.append(data)
79 if data is not None: 84 log.write(data)
80 errdata.append(data) 85 return ''.join(outdata), ''.join(errdata)
81 log.write(data)
82 return ''.join(outdata), ''.join(errdata)
83 86
84def run(cmd, input=None, **options): 87def run(cmd, input=None, **options):
85 """Convenience function to run a command and return its output, raising an 88 """Convenience function to run a command and return its output, raising an