[Downloader] Ensure consistent output from git commands (#3160)

* fix(downloader): ensure consistent output from git commands

* chore(changelog): add towncrier entry
This commit is contained in:
jack1142 2019-12-08 01:31:43 +01:00 committed by Michael H
parent d136d594f4
commit 672050727f
2 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1 @@
Ensure consistent output from git commands for purpose of parsing.

View File

@ -513,6 +513,12 @@ class Repo(RepoJSONMixin):
""" """
env = os.environ.copy() env = os.environ.copy()
env["GIT_TERMINAL_PROMPT"] = "0" env["GIT_TERMINAL_PROMPT"] = "0"
# attempt to force all output to plain ascii english
# some methods that parse output may expect it
# according to gettext manual both variables have to be set:
# https://www.gnu.org/software/gettext/manual/gettext.html#Locale-Environment-Variables
env["LC_ALL"] = "C"
env["LANGUAGE"] = "C"
kwargs["env"] = env kwargs["env"] = env
async with self._repo_lock: async with self._repo_lock:
p: CompletedProcess = await self._loop.run_in_executor( p: CompletedProcess = await self._loop.run_in_executor(