diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-29 23:44:21 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-12-29 23:50:37 -0700 |
commit | 5ec4ca7e45bdf6d259503fc67155395e89ba6329 (patch) | |
tree | 0951800c60cdb6d11803d0e5056da6d156d439ba /lib/bb/process.py | |
parent | d88dfcc749c57bb7ea3f5293ad6c6c687f7bb258 (diff) | |
download | bitbake-5ec4ca7e45bdf6d259503fc67155395e89ba6329.tar.gz |
process: fix handling of the input argument
When using a logfile, we weren't sending input to the child process.
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/process.py')
-rw-r--r-- | lib/bb/process.py | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lib/bb/process.py b/lib/bb/process.py index dc97e3f72..0e19cbe8d 100644 --- a/lib/bb/process.py +++ b/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 |