Skip to content

Commit

Permalink
feat: remove old unix socket before binding
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Jun 4, 2024
1 parent 3a585ea commit 554afc5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ async fn main() -> anyhow::Result<()> {

if let Some(path) = &ARGS.unix_socket {
info!("Listening on unix socket {}", path.display());
// remove old unix socket to avoid "Already already in use" error
if path.exists() {
std::fs::remove_file(&path)?;
}

let listener = tokio::net::UnixListener::bind(&path)?;

// chmod 777
Expand Down

0 comments on commit 554afc5

Please sign in to comment.