diff options
author | Tom Rini <trini@konsulko.com> | 2022-03-02 10:38:00 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-03-02 10:38:00 -0500 |
commit | f861ffa660dc47c4017c220b94d10a64439d46a7 (patch) | |
tree | 7ba56091d7713bf04e940afa9a2f8adcaeeb2a16 /tools/patman/cros_subprocess.py | |
parent | f9a719e2954473f9be1f8c14a28288f943a00dd2 (diff) | |
parent | 642e51addf918e0dd1b901efaa9f5706c12365b7 (diff) |
Merge branch '2022-03-02-enable-pylint-in-CI' into next
To quote the author:
This series adds a new errors-only pylint check and adds it to the CI
systems.
It also fixes the current errors in the U-Boot Python code, disabling
errors where it seems necessary.
A small patch to buildman allows it to build sandbox without any changes
to the default config file
Diffstat (limited to 'tools/patman/cros_subprocess.py')
-rw-r--r-- | tools/patman/cros_subprocess.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py index f1b26087cfd..cd614f38a64 100644 --- a/tools/patman/cros_subprocess.py +++ b/tools/patman/cros_subprocess.py @@ -113,7 +113,7 @@ class Popen(subprocess.Popen): return b'' return data - def communicate_filter(self, output): + def communicate_filter(self, output, input_buf=''): """Interact with process: Read data from stdout and stderr. This method runs until end-of-file is reached, then waits for the @@ -166,7 +166,7 @@ class Popen(subprocess.Popen): # Flush stdio buffer. This might block, if the user has # been writing to .stdin in an uncontrolled fashion. self.stdin.flush() - if input: + if input_buf: write_set.append(self.stdin) else: self.stdin.close() @@ -195,10 +195,10 @@ class Popen(subprocess.Popen): # When select has indicated that the file is writable, # we can write up to PIPE_BUF bytes without risk # blocking. POSIX defines PIPE_BUF >= 512 - chunk = input[input_offset : input_offset + 512] + chunk = input_buf[input_offset : input_offset + 512] bytes_written = os.write(self.stdin.fileno(), chunk) input_offset += bytes_written - if input_offset >= len(input): + if input_offset >= len(input_buf): self.stdin.close() write_set.remove(self.stdin) @@ -240,16 +240,6 @@ class Popen(subprocess.Popen): stderr = self.convert_data(stderr) combined = self.convert_data(combined) - # Translate newlines, if requested. We cannot let the file - # object do the translation: It is based on stdio, which is - # impossible to combine with select (unless forcing no - # buffering). - if self.universal_newlines and hasattr(file, 'newlines'): - if stdout: - stdout = self._translate_newlines(stdout) - if stderr: - stderr = self._translate_newlines(stderr) - self.wait() return (stdout, stderr, combined) |