Bug 1575804 - Don't decode the result from check_cmd_output. r=froydnj

Bug 1575135 changed check_cmd_output to return unicode strings, but a
couple places were already trying to do their own decoding, which now
can fail. Remove those.

Interesting the decoding was previously broken on Windows, this
actually fixes it (the output of hg config is not actually utf-8 on
Windows).

Differential Revision: https://phabricator.services.mozilla.com/D43044

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-08-22 17:02:39 +00:00
parent fdda6b6a38
commit 32044bbc45
2 changed files with 1 additions and 12 deletions

View File

@ -506,17 +506,6 @@ def hg_config(build_env, hg, version):
# `hg version` worked.
out = check_cmd_output(hg, 'config', env=env, cwd=build_env.topsrcdir)
# out is bytes. However, unicode literals are in effect, so implicit
# type coercion can occur. The underlying Mercurial config file may be
# in a user-defined encoding. However, HGPLAIN both overrides the decoding
# inside Mercurial *and* ensures output is utf-8. Because moz.configure
# is using unicode literals, our returned config object uses unicode
# keys and values to limit potential for coercion.
# Mercurial should emit utf-8. But be paranoid and ignore invalid utf-8
# byte sequences.
out = out.decode('utf-8', 'replace')
config = {}
for line in out.strip().splitlines():

View File

@ -2157,7 +2157,7 @@ def gnu_as(assembler, c_compiler, toolchain_flags):
# close the stdin pipe.
# clang will error if it uses its integrated assembler for this target,
# so handle failures gracefully.
if 'GNU' in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: '').decode('utf-8'):
if 'GNU' in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: ''):
return True