Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert returned binary data from call() to string #21656

Merged
merged 1 commit into from Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions tools/wpt/browser.py
Expand Up @@ -1087,11 +1087,11 @@ def version(self, binary=None, webdriver_binary=None):
except subprocess.CalledProcessError:
self.logger.warning("Failed to call %s --version" % webdriver_binary)
return None
m = re.match(br"Included with Safari (.*)", version_string)
m = re.match(r"Included with Safari (.*)", version_string)
if not m:
self.logger.warning("Failed to extract version from: %s" % version_string)
return None
return m.group(1).decode()
return m.group(1)


class Servo(Browser):
Expand Down Expand Up @@ -1234,7 +1234,7 @@ def find_binary(self, venv_path=None, channel=None):
gcc = find_executable("gcc")
if gcc:
try:
triplet = call(gcc, "-dumpmachine").decode().strip()
triplet = call(gcc, "-dumpmachine").strip()
except subprocess.CalledProcessError:
pass
# Add Debian/Ubuntu path
Expand All @@ -1253,7 +1253,7 @@ def version(self, binary=None, webdriver_binary=None):
if binary is None:
return None
try: # WebKitGTK MiniBrowser before 2.26.0 doesn't support --version
output = call(binary, "--version").decode().strip()
output = call(binary, "--version").strip()
except subprocess.CalledProcessError:
return None
# Example output: "WebKitGTK 2.26.1"
Expand Down
2 changes: 1 addition & 1 deletion tools/wpt/utils.py
Expand Up @@ -46,7 +46,7 @@ def call(*args):
"""
logger.debug(" ".join(args))
try:
return subprocess.check_output(args)
return subprocess.check_output(args).decode('utf8')
except subprocess.CalledProcessError as e:
logger.critical("%s exited with return code %i" %
(e.cmd, e.returncode))
Expand Down