changeset 29832:bac1829ec31f

util: checknlink should remove file it creates if an exception occurs There's no reason to leave the file behind.
author Tony Tung <tonytung@merly.org>
date Fri, 19 Aug 2016 13:30:40 -0700
parents 1316c7cccc76
children a8933d992a71
files mercurial/util.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Tue Aug 23 17:58:53 2016 -0700
+++ b/mercurial/util.py	Fri Aug 19 13:30:40 2016 -0700
@@ -1341,6 +1341,10 @@
     try:
         posixfile(f1, 'w').close()
     except IOError:
+        try:
+            os.unlink(f1)
+        except OSError:
+            pass
         return False
 
     f2 = testfile + ".hgtmp2"