summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-12-29 23:44:21 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:53 +0000
commit043adbfa0902dd06ed44a610a48ae3712e3ac1d3 (patch)
treedac77e36962100a0bfd066704576597ba61be00e
parent572bf4b3821b1df7abacd3badfdd7114ab381c4a (diff)
downloadopenembedded-core-043adbfa0902dd06ed44a610a48ae3712e3ac1d3.tar.gz
openembedded-core-043adbfa0902dd06ed44a610a48ae3712e3ac1d3.tar.bz2
openembedded-core-043adbfa0902dd06ed44a610a48ae3712e3ac1d3.zip
process: fix handling of the input argument
When using a logfile, we weren't sending input to the child process. (Bitbake rev: 5ec4ca7e45bdf6d259503fc67155395e89ba6329) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-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):
subprocess.Popen.__init__(self, *args, **options)
def _logged_communicate(pipe, log, input):
+ if pipe.stdin:
+ if input is not None:
+ pipe.stdin.write(input)
+ pipe.stdin.close()
+
bufsize = 512
- hasoutput = pipe.stdout is not None or pipe.stderr is not None
- if hasoutput:
- outdata, errdata = [], []
- while pipe.poll() is None:
- if pipe.stdout is not None:
- data = pipe.stdout.read(bufsize)
- if data is not None:
- outdata.append(data)
- log.write(data)
-
- if pipe.stderr is not None:
- data = pipe.stderr.read(bufsize)
- if data is not None:
- errdata.append(data)
- log.write(data)
- return ''.join(outdata), ''.join(errdata)
+ outdata, errdata = [], []
+ while pipe.poll() is None:
+ if pipe.stdout is not None:
+ data = pipe.stdout.read(bufsize)
+ if data is not None:
+ outdata.append(data)
+ log.write(data)
+
+ if pipe.stderr is not None:
+ data = pipe.stderr.read(bufsize)
+ if data is not None:
+ errdata.append(data)
+ log.write(data)
+ return ''.join(outdata), ''.join(errdata)
def run(cmd, input=None, **options):
"""Convenience function to run a command and return its output, raising an