Skip to content

Commit

Permalink
Clean symlinks as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Jan 26, 2025
1 parent 8fc0c73 commit af8e1f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/portable/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,16 @@ pub fn stop_and_disable(name: &str) -> anyhow::Result<bool> {
fs::remove_file(unit_path)?;
}

// Clear the runstate dir - macOS wouldn't delete UNIX domain socket
// files after server shutdown, which may lead to issues in upgrades
// Clear the runstate dir of socket files and symlinks - macOS wouldn't
// delete UNIX domain socket files after server shutdown, which may lead to
// issues in upgrades
let dir_path = runstate_dir(name)?;
for entry in fs::read_dir(dir_path)? {
let entry = entry?;
let path = entry.path();

if let Ok(metadata) = path.metadata() {
if metadata.file_type().is_socket() {
if metadata.file_type().is_socket() || metadata.file_type().is_symlink() {
fs::remove_file(&path)?;
}
}
Expand Down

0 comments on commit af8e1f9

Please sign in to comment.