Skip to content

Commit 805c94e

Browse files
Merge pull request #1900 from saschahauer/managed-file-fix
util/managedfile: fix symlink creation for local case
2 parents be8f3a2 + e057597 commit 805c94e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

labgrid/util/managedfile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def sync_to_resource(self, symlink=None):
8181
# --symbolic --force --no-dereference
8282
conn.run_check(f"ln -sfn {self.rpath}{os.path.basename(self.local_path)} {symlink}")
8383
else:
84-
if os.path.exists(symlink) and not os.path.islink(symlink):
84+
if os.path.islink(symlink):
85+
os.unlink(symlink)
86+
elif os.path.exists(symlink):
8587
raise ManagedFileError(f"Path {symlink} exists but is not a symlink.")
8688
os.symlink(f"{self.rpath}{os.path.basename(self.local_path)}", symlink)
8789

0 commit comments

Comments
 (0)