Merge pull request #2325 from xonsh/win_path

Fix win paths
This commit is contained in:
Konstantinos Tsakiltzidis 2017-03-26 17:10:44 +03:00 committed by GitHub
commit 32eda6922c
2 changed files with 18 additions and 0 deletions

14
news/win_path.rst Normal file
View file

@ -0,0 +1,14 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fixed a bug on Windows which meant xonsh wasn't using PATH enrivonment variable but instead relying on a default
value from the widnows registry.
**Security:** None

View file

@ -794,6 +794,10 @@ class Env(cabc.MutableMapping):
args = (os_environ,)
for key, val in dict(*args, **kwargs).items():
self[key] = val
if ON_WINDOWS:
path_key = next((k for k in self._d if k.upper() == 'PATH'), None)
if path_key:
self['PATH'] = self._d.pop(path_key)
if 'PATH' not in self._d:
# this is here so the PATH is accessible to subprocs and so that
# it can be modified in-place in the xonshrc file