# HG changeset patch # User Tony Tung # Date 2016-08-19 20:30:40 # Node ID bac1829ec31f469b03eed092fc751f742e6d5b27 # Parent 1316c7cccc76288274070c5f7dd68dd5dded2bec util: checknlink should remove file it creates if an exception occurs There's no reason to leave the file behind. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1341,6 +1341,10 @@ def checknlink(testfile): try: posixfile(f1, 'w').close() except IOError: + try: + os.unlink(f1) + except OSError: + pass return False f2 = testfile + ".hgtmp2"