check exec: return fallback in case of error during the check
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 24 Aug 2007 00:38:08 +0200
changeset 5212 316ce5e85b3e
parent 5185 156f4c8a12aa
child 5213 b0bc8cf41ffc
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
mercurial/util.py
--- a/mercurial/util.py	Fri Aug 17 00:42:22 2007 +0200
+++ b/mercurial/util.py	Fri Aug 24 00:38:08 2007 +0200
@@ -793,12 +793,16 @@
 
     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):