nsinstall.py: os.remove() may fail, handle it

This commit is contained in:
2018-03-03 12:31:56 +08:00
parent cfc0615528
commit cf344f822e
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -128,7 +128,10 @@ def _nsinstall_internal(argv):
if os.path.exists(targetpath):
# On Windows, read-only files can't be deleted
os.chmod(targetpath, stat.S_IWUSR)
os.remove(targetpath)
try:
os.remove(targetpath)
except:
pass
if options.t:
shutil.copy2(srcpath, targetpath)
else:
+4 -1
View File
@@ -128,7 +128,10 @@ def _nsinstall_internal(argv):
if os.path.exists(targetpath):
# On Windows, read-only files can't be deleted
os.chmod(targetpath, stat.S_IWUSR)
os.remove(targetpath)
try:
os.remove(targetpath)
except:
pass
if options.t:
shutil.copy2(srcpath, targetpath)
else: