diff --git a/src/bin/daemon.rs b/src/bin/daemon.rs index ba7ee9b..e546f2e 100644 --- a/src/bin/daemon.rs +++ b/src/bin/daemon.rs @@ -47,8 +47,10 @@ async fn main() -> Result<(), Box> { lock_file.lock()?; let socket_path = runtime_dir.join("daemon.sock"); - if fs::metadata(&socket_path).is_ok() { - fs::remove_file(&socket_path)?; + if let Err(e) = fs::remove_file(&socket_path) { + if e.kind() != std::io::ErrorKind::NotFound { + return Err(e.into()); + } } let listener = UnixListener::bind(&socket_path)?;