Bug 1476147 - Use path.isfile() instead of patch.exists() in which(). r=glandium

This excludes directories, and returns true only if it's an executable file.

Differential Revision: https://phabricator.services.mozilla.com/D3366

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2018-08-15 06:15:57 +00:00
parent 78af5fd2ae
commit 1199851701

View File

@ -305,7 +305,7 @@ class BaseBootstrapper(object):
"""
for path in os.environ['PATH'].split(os.pathsep):
test = os.path.join(path, name)
if os.path.exists(test) and os.access(test, os.X_OK):
if os.path.isfile(test) and os.access(test, os.X_OK):
return test
return None