Commit 32044bbc authored by Mike Hommey's avatar Mike Hommey
Browse files

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
parent fdda6b6a
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -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():
+1 −1
Original line number Diff line number Diff line
@@ -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