Commit 6a9b00e4 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

scm: Replace invalid UTF-8 in Git output

This may occur when git diff is ran with binary changes in the diff.
Example: https://chromium-review.googlesource.com/c/chromium/src/+/1606595

Bug: 942522
Change-Id: I44caef559de44076ef394caa5abc3967db2bb0b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1607840
Auto-Submit: Raul Tambre <raul@tambre.ee>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
parent 06f5b226
...@@ -118,7 +118,7 @@ class GIT(object): ...@@ -118,7 +118,7 @@ class GIT(object):
env = GIT.ApplyEnvVars(kwargs) env = GIT.ApplyEnvVars(kwargs)
output = subprocess2.check_output( output = subprocess2.check_output(
['git'] + args, cwd=cwd, stderr=subprocess2.PIPE, env=env, ['git'] + args, cwd=cwd, stderr=subprocess2.PIPE, env=env,
**kwargs).decode('utf-8') **kwargs).decode('utf-8', 'replace')
return output.strip() if strip_out else output return output.strip() if strip_out else output
@staticmethod @staticmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment