Encode the environment variables passed to git
Windows allows the environment to have unicode values.
This will cause Python to fail to execute the command.
Change-Id: I37d922c3d7ced0d5b4883f0220346ac42defc5e9
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/subcmds/sync.py b/subcmds/sync.py
index d6ea442..80bba1a 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -269,7 +269,7 @@
if branch.startswith(R_HEADS):
branch = branch[len(R_HEADS):]
- env = dict(os.environ)
+ env = os.environ.copy()
if (env.has_key('TARGET_PRODUCT') and
env.has_key('TARGET_BUILD_VARIANT')):
target = '%s-%s' % (env['TARGET_PRODUCT'],
@@ -413,9 +413,9 @@
% (project.name, rev)
return False
- env = dict(os.environ)
- env['GIT_DIR'] = project.gitdir
- env['GNUPGHOME'] = gpg_dir
+ env = os.environ.copy()
+ env['GIT_DIR'] = project.gitdir.encode()
+ env['GNUPGHOME'] = gpg_dir.encode()
cmd = [GIT, 'tag', '-v', cur]
proc = subprocess.Popen(cmd,