Eryk Sun <eryk...@gmail.com> added the comment:

> whens searching for executables, Windows gives "exes that are in the
> same directory as the currently executing code" priority over PATH.

That subprocess lets CreateProcessW use a platform-dependent search that 
prioritizes the application directory has come up in previous issues. To avoid 
this, we'd have to implement our own search for the given or parsed executable 
name. Then pass the fully-qualified executable path as the lpApplicationName 
name of CreateProcessW. This is how CMD works, since it has its own search 
routine that incorporates the PATHEXT environment variable.

Because the application directory is searched before the working directory (if 
the working directory is searched at all, depending on context), this issue 
also affects searching for executable paths that contain a path separator. In 
Unix a relative path that contains a path separator is always relative to the 
working directory, but Windows CreateProcessW uses a normal search for a 
relative name unless it explicitly references the working directory as "." 
(e.g. ".\Scripts\pip.exe" instead of "Scripts\pip.exe").

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38905>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to