diff --git a/crates/nu-cli/src/shell/filesystem_shell.rs b/crates/nu-cli/src/shell/filesystem_shell.rs index 76cb0ac230..c9d18f6e1f 100644 --- a/crates/nu-cli/src/shell/filesystem_shell.rs +++ b/crates/nu-cli/src/shell/filesystem_shell.rs @@ -596,9 +596,15 @@ impl Shell for FilesystemShell { }; if let Ok(metadata) = f.symlink_metadata() { + #[cfg(unix)] + let is_socket = metadata.file_type().is_socket(); + #[cfg(not(unix))] + let is_socket = false; + if metadata.is_file() || metadata.file_type().is_symlink() || recursive.item + || is_socket || is_empty() { let result; @@ -620,7 +626,7 @@ impl Shell for FilesystemShell { } #[cfg(not(feature = "trash-support"))] { - result = if metadata.is_file() { + result = if metadata.is_file() || is_socket { std::fs::remove_file(&f) } else { std::fs::remove_dir_all(&f)