aboutsummaryrefslogtreecommitdiff
path: root/tools/patman/cros_subprocess.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-05-14 15:53:44 -0600
committerSimon Glass <sjg@chromium.org>2019-07-10 16:52:57 -0600
commita92939a4aa65700c3cdfa230fa986d40c508c5e6 (patch)
treea45fd979c1c7809fa4ced00e4870cf0bf1a29df5 /tools/patman/cros_subprocess.py
parent3e4b51e8d6dc86c0ea80552a1d2e19756b19e4a1 (diff)
downloadu-boot-a92939a4aa65700c3cdfa230fa986d40c508c5e6.zip
u-boot-a92939a4aa65700c3cdfa230fa986d40c508c5e6.tar.gz
u-boot-a92939a4aa65700c3cdfa230fa986d40c508c5e6.tar.bz2
patman: Provide a way to get program output in binary mode
At present cros_subprocess and the tools library use a string to obtain stdout from a program. This works fine on Python 2. With Python 3 we end up with unicode errors in some cases. Fix this by providing a binary mode, which returns the data as bytes() instead of a string. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/cros_subprocess.py')
-rw-r--r--tools/patman/cros_subprocess.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py
index 0f0d60d..06be64c 100644
--- a/tools/patman/cros_subprocess.py
+++ b/tools/patman/cros_subprocess.py
@@ -54,7 +54,7 @@ class Popen(subprocess.Popen):
"""
def __init__(self, args, stdin=None, stdout=PIPE_PTY, stderr=PIPE_PTY,
- shell=False, cwd=None, env=None, **kwargs):
+ shell=False, cwd=None, env=None, binary=False, **kwargs):
"""Cut-down constructor
Args:
@@ -72,6 +72,7 @@ class Popen(subprocess.Popen):
"""
stdout_pty = None
stderr_pty = None
+ self.binary = binary
if stdout == PIPE_PTY:
stdout_pty = pty.openpty()