helpers: don't trap exception on failure to unlink

If we can't unlink a file we expect to unlink, logging and moving on is
probably the wrong action.

Coverage never hits this line.
This commit is contained in:
James R. Barlow
2021-04-07 23:16:10 -07:00
parent 336d274a54
commit 8423bd549b
+1 -4
View File
@@ -87,10 +87,7 @@ def safe_symlink(input_file: os.PathLike, soft_link_name: os.PathLike):
# do not delete or overwrite real (non-soft link) file
if not os.path.islink(soft_link_name):
raise FileExistsError(f"{soft_link_name} exists and is not a link")
try:
os.unlink(soft_link_name)
except OSError:
log.debug("Can't unlink %s", soft_link_name)
os.unlink(soft_link_name)
if not os.path.exists(input_file):
raise FileNotFoundError(f"trying to create a broken symlink to {input_file}")