mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[lit] Fix bug where `lit.util.which()
` would return a directory
instead of executable if the argument was found inside a directory contained in PATH. An example where this could cause a problem is if there was a RUN line that ran the ``test`` command and if the user had a directory in their PATH that contained a directory called ``test/`` (that occured before ``/usr/bin/``). Lit would try to use the directory as the executable which would fail with the rather cryptic message. ``` Could not create process due to [Errno 13] Permission denied ``` llvm-svn: 253031
This commit is contained in:
parent
7d379efeea
commit
41d8464b41
@ -94,7 +94,7 @@ def which(command, paths = None):
|
||||
for path in paths.split(os.pathsep):
|
||||
for ext in pathext:
|
||||
p = os.path.join(path, command + ext)
|
||||
if os.path.exists(p):
|
||||
if os.path.exists(p) and not os.path.isdir(p):
|
||||
return p
|
||||
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user