fix(unix): correctly delete sock in not already exist

This commit is contained in:
Σrebe - Romain GERARD 2024-01-21 10:59:42 +01:00
parent 2994618fad
commit b7dbd864c4
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4

View file

@ -50,7 +50,7 @@ impl Stream for UnixListenerStream {
pub async fn run_server(socket_path: &Path) -> Result<UnixListenerStream, anyhow::Error> { pub async fn run_server(socket_path: &Path) -> Result<UnixListenerStream, anyhow::Error> {
info!("Starting Unix socket server listening cnx on {:?}", socket_path); info!("Starting Unix socket server listening cnx on {:?}", socket_path);
let path_to_delete = socket_path.exists(); let path_to_delete = !socket_path.exists();
let listener = UnixListener::bind(socket_path) let listener = UnixListener::bind(socket_path)
.with_context(|| format!("Cannot create Unix socket server {:?}", socket_path))?; .with_context(|| format!("Cannot create Unix socket server {:?}", socket_path))?;