mercurial/util.py
changeset 9544 b6b0c42739e9
parent 9517 4368f582c806
parent 9529 e61e7b3e46d0
child 9548 7732606b0767
equal deleted inserted replaced
9543:56a5f80556f5 9544:b6b0c42739e9
   425                     return temp
   425                     return temp
   426             raise IOError, (errno.EEXIST, "No usable temporary filename found")
   426             raise IOError, (errno.EEXIST, "No usable temporary filename found")
   427 
   427 
   428         temp = tempname(dst)
   428         temp = tempname(dst)
   429         os.rename(dst, temp)
   429         os.rename(dst, temp)
   430         os.unlink(temp)
   430         try:
       
   431             os.unlink(temp)
       
   432         except:
       
   433             # Some rude AV-scanners on Windows may cause the unlink to
       
   434             # fail. Not aborting here just leaks the temp file, whereas
       
   435             # aborting at this point may leave serious inconsistencies.
       
   436             # Ideally, we would notify the user here.
       
   437             pass
   431         os.rename(src, dst)
   438         os.rename(src, dst)
   432 
   439 
   433 def unlink(f):
   440 def unlink(f):
   434     """unlink and remove the directory if it is empty"""
   441     """unlink and remove the directory if it is empty"""
   435     os.unlink(f)
   442     os.unlink(f)