Fixes error when trying to delete a FIFO (#3235)

* Output error when ls into a file without permission

* added test to check fails when ls into prohibited dir

* fix lint

* trigger wasm build

* be able to remove fifos

* Update filesystem_shell.rs

* I thought windows had fifos

* fixed unix and windows conditional compilation

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
This commit is contained in:
Luccas Mateus 2021-03-31 14:10:40 -03:00 committed by GitHub
parent 06b154f4b2
commit 90fae903ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -671,13 +671,19 @@ impl Shell for FilesystemShell {
if let Ok(metadata) = f.symlink_metadata() {
#[cfg(unix)]
let is_socket = metadata.file_type().is_socket();
#[cfg(unix)]
let is_fifo = metadata.file_type().is_fifo();
#[cfg(not(unix))]
let is_socket = false;
#[cfg(not(unix))]
let is_fifo = false;
if metadata.is_file()
|| metadata.file_type().is_symlink()
|| recursive.item
|| is_socket
|| is_fifo
|| is_empty()
{
let result;
@ -699,7 +705,7 @@ impl Shell for FilesystemShell {
}
#[cfg(not(feature = "trash-support"))]
{
result = if metadata.is_file() || is_socket {
result = if metadata.is_file() || is_socket || is_fifo {
std::fs::remove_file(&f)
} else {
std::fs::remove_dir_all(&f)