From 14cd798f0083d9dcfa6b58834138440241654b94 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Thu, 6 Jan 2022 09:21:15 +1100 Subject: [PATCH] Make ls more forgiving (#681) --- crates/nu-command/src/filesystem/ls.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/crates/nu-command/src/filesystem/ls.rs b/crates/nu-command/src/filesystem/ls.rs index a6c37bb39..d072339b1 100644 --- a/crates/nu-command/src/filesystem/ls.rs +++ b/crates/nu-command/src/filesystem/ls.rs @@ -8,7 +8,6 @@ use nu_protocol::{ ShellError, Signature, Span, Spanned, SyntaxShape, Value, }; -use std::io::ErrorKind; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; use std::path::PathBuf; @@ -128,17 +127,7 @@ impl Command for Ls { Ok(path) => { let metadata = match std::fs::symlink_metadata(&path) { Ok(metadata) => Some(metadata), - Err(e) => { - if e.kind() == ErrorKind::PermissionDenied - || e.kind() == ErrorKind::Other - { - None - } else { - return Some(Value::Error { - error: ShellError::IOError(format!("{}", e)), - }); - } - } + Err(_) => None, }; if path_contains_hidden_folder(&path, &hidden_dirs) { return None;