changeset 15056:8413916df816

posix: check for executable bits on files identified by findexe function
author Robert Jones <rob@redshirtsoftware.com>
date Wed, 24 Aug 2011 05:42:41 -0400
parents 7c03e3b1b858
children 774da7121fc9
files mercurial/posix.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Thu Aug 25 16:21:53 2011 -0500
+++ b/mercurial/posix.py	Wed Aug 24 05:42:41 2011 -0400
@@ -256,7 +256,9 @@
     for path in os.environ.get('PATH', '').split(os.pathsep):
         executable = findexisting(os.path.join(path, command))
         if executable is not None:
-            return executable
+            st = os.stat(executable)
+            if (st.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)):
+                return executable
     return None
 
 def setsignalhandler():