Commit f8a81075 authored by Michael Büsch's avatar Michael Büsch

util: Add exception handler to unlink call

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 4b73c7d1
......@@ -201,7 +201,7 @@ def safeFileWrite(filename, data):
if not osIsPosix: #@nocov
# Can't use safe rename on non-POSIX.
# Must unlink first.
with contextlib.suppress(OSError):
with contextlib.suppress(IOError, OSError):
os.unlink(filename)
os.rename(tmpFile, filename)
except (IOError, OSError) as e: #@nocov
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment