Skip to content

Commit

Permalink
win32: force PATH to be non-unicode on win32, if virtualenv munges it
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuk authored and larsbergstrom committed Jan 20, 2016
1 parent ee863fd commit 5b845cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/servo/command_base.py
Expand Up @@ -224,6 +224,14 @@ def get_binary_path(self, release, dev, android=False):
def build_env(self, gonk=False, hosts_file_path=None):
"""Return an extended environment dictionary."""
env = os.environ.copy()
if sys.platform == "win32" and type(env['PATH']) == unicode:
# On win32, the virtualenv's activate_this.py script sometimes ends up
# turning os.environ['PATH'] into a unicode string. This doesn't work
# for passing env vars in to a process, so we force it back to ascii.
# We don't use UTF8 since that won't be correct anyway; if you actually
# have unicode stuff in your path, all this PATH munging would have broken
# it in any case.
env['PATH'] = env['PATH'].encode('ascii', 'ignore')
extra_path = []
extra_lib = []
if not self.config["tools"]["system-rust"] \
Expand Down

0 comments on commit 5b845cb

Please sign in to comment.