From ded477dbb9c6993cbe8b93b10654682b04fdeea8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 7 Feb 2020 23:18:23 -0500 Subject: [PATCH] git_config: fix encoding handling in GetUrlCookieFile Make sure we decode the bytes coming from the subprocess.Popen as we're treating them as strings. Change-Id: I44100ca5cd94f68a35d489936292eb641006edbe Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253973 Reviewed-by: Jonathan Nieder Tested-by: Mike Frysinger --- git_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git_config.py b/git_config.py index 680de90f..8de3200c 100644 --- a/git_config.py +++ b/git_config.py @@ -528,7 +528,7 @@ def GetUrlCookieFile(url, quiet): cookiefile = None proxy = None for line in p.stdout: - line = line.strip() + line = line.strip().decode('utf-8') if line.startswith(cookieprefix): cookiefile = os.path.expanduser(line[len(cookieprefix):]) if line.startswith(proxyprefix): @@ -540,7 +540,7 @@ def GetUrlCookieFile(url, quiet): finally: p.stdin.close() if p.wait(): - err_msg = p.stderr.read() + err_msg = p.stderr.read().decode('utf-8') if ' -print_config' in err_msg: pass # Persistent proxy doesn't support -print_config. elif not quiet: