decode strings to utf-8 and use universal_newlines for subprocess

Bug: webrtc:13607
Change-Id: I4d8df7488b819b477cd0ae5553c0eb8a7adfb179
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251343
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Christoffer Jansson <jansson@google.com>
Cr-Commit-Position: refs/heads/main@{#35955}
This commit is contained in:
Christoffer Jansson 2022-02-08 18:24:29 +01:00 committed by WebRTC LUCI CQ
parent 8e3441933f
commit 409ac89b43

View File

@ -24,7 +24,10 @@ from tracing.value.diagnostics import reserved_infos
def _GenerateOauthToken(): def _GenerateOauthToken():
args = ['luci-auth', 'token'] args = ['luci-auth', 'token']
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(args,
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if p.wait() == 0: if p.wait() == 0:
output = p.stdout.read() output = p.stdout.read()
return output.strip() return output.strip()
@ -193,7 +196,7 @@ def _ApplyHacks(dicts):
def _LoadHistogramSetFromProto(options): def _LoadHistogramSetFromProto(options):
hs = histogram_set.HistogramSet() hs = histogram_set.HistogramSet()
with options.input_results_file as f: with options.input_results_file as f:
hs.ImportProto(f.read()) hs.ImportProto(f.read().decode('utf-8'))
return hs return hs