mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
check exec: return fallback in case of error during the check
If there is any error while checking if exec is supported, we can return fallback. fix issue705
This commit is contained in:
parent
c012edc900
commit
f71cd2e266
@ -793,12 +793,16 @@ def checkexec(path):
|
||||
|
||||
Requires a directory (like /foo/.hg)
|
||||
"""
|
||||
fh, fn = tempfile.mkstemp("", "", path)
|
||||
os.close(fh)
|
||||
m = os.stat(fn).st_mode
|
||||
os.chmod(fn, m ^ 0111)
|
||||
r = (os.stat(fn).st_mode != m)
|
||||
os.unlink(fn)
|
||||
try:
|
||||
fh, fn = tempfile.mkstemp("", "", path)
|
||||
os.close(fh)
|
||||
m = os.stat(fn).st_mode
|
||||
os.chmod(fn, m ^ 0111)
|
||||
r = (os.stat(fn).st_mode != m)
|
||||
os.unlink(fn)
|
||||
except (IOError,OSError):
|
||||
# we don't care, the user probably won't be able to commit anyway
|
||||
return False
|
||||
return r
|
||||
|
||||
def execfunc(path, fallback):
|
||||
|
Loading…
Reference in New Issue
Block a user