mirror of
https://github.com/nushell/nushell
synced 2025-01-15 14:44:14 +00:00
Make ls more forgiving (#681)
This commit is contained in:
parent
cc1ae969fe
commit
14cd798f00
1 changed files with 1 additions and 12 deletions
|
@ -8,7 +8,6 @@ use nu_protocol::{
|
||||||
ShellError, Signature, Span, Spanned, SyntaxShape, Value,
|
ShellError, Signature, Span, Spanned, SyntaxShape, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::io::ErrorKind;
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -128,17 +127,7 @@ impl Command for Ls {
|
||||||
Ok(path) => {
|
Ok(path) => {
|
||||||
let metadata = match std::fs::symlink_metadata(&path) {
|
let metadata = match std::fs::symlink_metadata(&path) {
|
||||||
Ok(metadata) => Some(metadata),
|
Ok(metadata) => Some(metadata),
|
||||||
Err(e) => {
|
Err(_) => None,
|
||||||
if e.kind() == ErrorKind::PermissionDenied
|
|
||||||
|| e.kind() == ErrorKind::Other
|
|
||||||
{
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
return Some(Value::Error {
|
|
||||||
error: ShellError::IOError(format!("{}", e)),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if path_contains_hidden_folder(&path, &hidden_dirs) {
|
if path_contains_hidden_folder(&path, &hidden_dirs) {
|
||||||
return None;
|
return None;
|
||||||
|
|
Loading…
Reference in a new issue