From 8df6b87a793434065cd9a01fcaa812e3ea47c4dd Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Mon, 17 Nov 2014 15:58:04 +0000 Subject: Copy environment for subprocess execution Git utilizes multiple environment variables to control various behaviours. Make sure to set LC_MESSAGES on a copy of the environment instead of discarding any variables that may be set by the user or default shell environment such as EDITOR. Add test to assert that when overriding GIT_EDITOR via os.environ that the modified value will be picked up by and git commands called. --- git/cmd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index 9cc6b1fa..f97dd3f6 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -341,8 +341,10 @@ class Git(LazyMixin): cwd = self._working_dir # Start the process + env = os.environ.copy() + env["LC_MESSAGES"] = "C" proc = Popen(command, - env={"LC_MESSAGES": "C"}, + env=env, cwd=cwd, stdin=istream, stderr=PIPE, -- cgit v1.2.1