mercurial/win32.py
branchstable
changeset 10219 3b94120864fc
parent 10218 750b7a4f01f6
child 10240 3af4b39afe2a
child 10263 25e572394f5c
--- a/mercurial/win32.py	Fri Jan 08 18:48:39 2010 +0530
+++ b/mercurial/win32.py	Fri Jan 08 23:15:22 2010 +0100
@@ -43,9 +43,10 @@
         fh = win32file.CreateFile(pathname,
             win32file.GENERIC_READ, win32file.FILE_SHARE_READ,
             None, win32file.OPEN_EXISTING, 0, None)
-        res = win32file.GetFileInformationByHandle(fh)
-        fh.Close()
-        return res
+        try:
+            return win32file.GetFileInformationByHandle(fh)
+        finally:
+            fh.Close()
     except pywintypes.error:
         return None