forked from extern/nushell
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:
parent
06b154f4b2
commit
90fae903ce
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user