Skip to content

Commit e76deb1

Browse files
authored
Merge pull request #75 from rust-cross/remove-broken-symlink
Remove broken symlink before creating new one
2 parents 0c658ea + 462b5ff commit e76deb1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/zig.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,10 @@ fn symlink_wrapper(target: &Path) -> Result<()> {
748748
#[cfg(unix)]
749749
{
750750
if !target.exists() {
751+
if fs::read_link(target).is_ok() {
752+
// remove broken symlink
753+
fs::remove_file(target)?;
754+
}
751755
std::os::unix::fs::symlink(current_exe, target)?;
752756
}
753757
}

0 commit comments

Comments
 (0)