mercurial/util.py
changeset 5214 316ce5e85b3e
parent 5093 84b10dc3dccc
child 5215 b0bc8cf41ffc
equal deleted inserted replaced
5179:156f4c8a12aa 5214:316ce5e85b3e
   791     """
   791     """
   792     Check whether the given path is on a filesystem with UNIX-like exec flags
   792     Check whether the given path is on a filesystem with UNIX-like exec flags
   793 
   793 
   794     Requires a directory (like /foo/.hg)
   794     Requires a directory (like /foo/.hg)
   795     """
   795     """
   796     fh, fn = tempfile.mkstemp("", "", path)
   796     try:
   797     os.close(fh)
   797         fh, fn = tempfile.mkstemp("", "", path)
   798     m = os.stat(fn).st_mode
   798         os.close(fh)
   799     os.chmod(fn, m ^ 0111)
   799         m = os.stat(fn).st_mode
   800     r = (os.stat(fn).st_mode != m)
   800         os.chmod(fn, m ^ 0111)
   801     os.unlink(fn)
   801         r = (os.stat(fn).st_mode != m)
       
   802         os.unlink(fn)
       
   803     except (IOError,OSError):
       
   804         # we don't care, the user probably won't be able to commit anyway
       
   805         return False
   802     return r
   806     return r
   803 
   807 
   804 def execfunc(path, fallback):
   808 def execfunc(path, fallback):
   805     '''return an is_exec() function with default to fallback'''
   809     '''return an is_exec() function with default to fallback'''
   806     if checkexec(path):
   810     if checkexec(path):