From 6a9b00e433cff68ea348a22a9f46483fe9f1c197 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Tue, 14 May 2019 01:54:23 +0000 Subject: [PATCH] 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 Commit-Queue: Dirk Pranke Reviewed-by: Dirk Pranke --- scm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm.py b/scm.py index 46c25a7201..39e9b4ea4e 100644 --- a/scm.py +++ b/scm.py @@ -118,7 +118,7 @@ class GIT(object): env = GIT.ApplyEnvVars(kwargs) output = subprocess2.check_output( ['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 @staticmethod