1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 08:09:08 -05:00

fix(net): don't panic on failed UDS removal (#15157)

If a Unix Domain Socket cannot be removed, throw instead of
panicing.

Fixes: https://github.com/denoland/deno/issues/14213
This commit is contained in:
Colin Ihrig 2022-07-12 11:53:53 -04:00 committed by GitHub
parent 2ff3e8a6c5
commit dcd05d4cb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,7 +144,7 @@ pub fn listen_unix(
addr: &Path,
) -> Result<(u32, tokio::net::unix::SocketAddr), AnyError> {
if addr.exists() {
remove_file(&addr).unwrap();
remove_file(&addr)?;
}
let listener = UnixListener::bind(&addr)?;
let local_addr = listener.local_addr()?;
@ -162,7 +162,7 @@ pub fn listen_unix_packet(
addr: &Path,
) -> Result<(u32, tokio::net::unix::SocketAddr), AnyError> {
if addr.exists() {
remove_file(&addr).unwrap();
remove_file(&addr)?;
}
let socket = UnixDatagram::bind(&addr)?;
let local_addr = socket.local_addr()?;