diff --git a/mercurial/posix.py b/mercurial/posix.py index ac5a340b26defa58eca5ae437f1a02d5508a5ceb_bWVyY3VyaWFsL3Bvc2l4LnB5..58f96703a9abd4c64c3c164ecef6ba8df3534446_bWVyY3VyaWFsL3Bvc2l4LnB5 100644 --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -258,7 +258,7 @@ def findexisting(executable): 'Will return executable if existing file' - if os.path.exists(executable): + if os.path.isfile(executable) and os.access(executable, os.X_OK): return executable return None @@ -268,9 +268,7 @@ for path in os.environ.get('PATH', '').split(os.pathsep): executable = findexisting(os.path.join(path, command)) if executable is not None: - st = os.stat(executable) - if (st.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)): - return executable + return executable return None def setsignalhandler():