diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-29 23:44:21 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:53 +0000 |
commit | 043adbfa0902dd06ed44a610a48ae3712e3ac1d3 (patch) | |
tree | dac77e36962100a0bfd066704576597ba61be00e /bitbake/lib/bb/process.py | |
parent | 572bf4b3821b1df7abacd3badfdd7114ab381c4a (diff) | |
download | poky-043adbfa0902dd06ed44a610a48ae3712e3ac1d3.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/process.py')
-rw-r--r-- | bitbake/lib/bb/process.py | 35 |
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 | ||
65 | def _logged_communicate(pipe, log, input): | 65 | def _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 | ||
84 | def run(cmd, input=None, **options): | 87 | def 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 |