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() {
|
if let Ok(metadata) = f.symlink_metadata() {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
let is_socket = metadata.file_type().is_socket();
|
let is_socket = metadata.file_type().is_socket();
|
||||||
|
#[cfg(unix)]
|
||||||
|
let is_fifo = metadata.file_type().is_fifo();
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
let is_socket = false;
|
let is_socket = false;
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
let is_fifo = false;
|
||||||
|
|
||||||
if metadata.is_file()
|
if metadata.is_file()
|
||||||
|| metadata.file_type().is_symlink()
|
|| metadata.file_type().is_symlink()
|
||||||
|| recursive.item
|
|| recursive.item
|
||||||
|| is_socket
|
|| is_socket
|
||||||
|
|| is_fifo
|
||||||
|| is_empty()
|
|| is_empty()
|
||||||
{
|
{
|
||||||
let result;
|
let result;
|
||||||
@ -699,7 +705,7 @@ impl Shell for FilesystemShell {
|
|||||||
}
|
}
|
||||||
#[cfg(not(feature = "trash-support"))]
|
#[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)
|
std::fs::remove_file(&f)
|
||||||
} else {
|
} else {
|
||||||
std::fs::remove_dir_all(&f)
|
std::fs::remove_dir_all(&f)
|
||||||
|
Loading…
Reference in New Issue
Block a user