Use 'backslashreplace' for decode

Resolve TODO as we are now requiring Python 3.

Change-Id: I7821627bd5c606276741c98efedaf5b11aecbcc3
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354702
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com>
This commit is contained in:
Daniel Kutik 2022-12-13 13:01:02 +01:00
parent e641281d14
commit 7438aef1ca

3
repo
View File

@ -447,8 +447,7 @@ def run_command(cmd, **kwargs):
except UnicodeError: except UnicodeError:
print('repo: warning: Invalid UTF-8 output:\ncmd: %r\n%r' % (cmd, output), print('repo: warning: Invalid UTF-8 output:\ncmd: %r\n%r' % (cmd, output),
file=sys.stderr) file=sys.stderr)
# TODO(vapier): Once we require Python 3, use 'backslashreplace'. return output.decode('utf-8', 'backslashreplace')
return output.decode('utf-8', 'replace')
# Run & package the results. # Run & package the results.
proc = subprocess.Popen(cmd, **kwargs) proc = subprocess.Popen(cmd, **kwargs)