Merge branch 'misc_fix' into track_wd

This commit is contained in:
Bob Hyman 2016-08-21 21:30:52 -04:00
commit f30f58d019
3 changed files with 18 additions and 1 deletions

1
.gitignore vendored
View file

@ -20,6 +20,7 @@ docs/_build/
docs/envvarsbody
docs/xontribsbody
xonsh/dev.githash
**/__pycache__/
# temporary files from vim and emacs
*~

13
news/commands_cache.rst Normal file
View file

@ -0,0 +1,13 @@
**Added:** None
**Changed:**
* ``lazy_locate_binary`` handles binary on different drive letter than current working directory (on Windows).
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -133,7 +133,10 @@ class CommandsCache(abc.Mapping):
if os.path.isfile(full_name)
), None)
if local_bin:
return os.path.abspath(os.path.relpath(local_bin, cwd))
if os.path.splitdrive(cwd)[0] != os.path.splitdrive(local_bin)[0]: # if cwd not on same drive as bin
return os.path.abspath(local_bin) # avoid ValueError in relpath()
else:
return os.path.abspath(os.path.relpath(local_bin, cwd))
cached = next((cmd for cmd in possibilities if cmd in self._cmds_cache), None)
if cached: