Commit 4167d7fe authored by Peter Wen's avatar Peter Wen Committed by Commit Bot

Android: Fix build_utils output for python 2

Error:
  util.build_utils.CalledProcessError: <exception str() failed>

This is due string.decode turning stdout and stderr into unicode strings
in python 2.

Bug: None
Change-Id: Id21da9a9126f31c851932a62a9fbf349a658ec7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2511881Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823686}
parent cc971c4b
......@@ -257,8 +257,8 @@ def CheckOutput(args,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd, env=env)
stdout, stderr = child.communicate()
# For Python3:
if isinstance(stdout, bytes):
# For Python3 only:
if isinstance(stdout, bytes) and sys.version_info >= (3, ):
stdout = stdout.decode('utf-8')
stderr = stderr.decode('utf-8')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment