Output error when ls into a file without permission (#3218)

* Output error when ls into a file without permission

* added test to check fails when ls into prohibited dir

* fix lint

* trigger wasm build

* Update filesystem_shell.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
This commit is contained in:
Luccas Mateus
2021-03-31 03:52:39 -03:00
committed by GitHub
parent 387098fc87
commit 419a0665c8
2 changed files with 48 additions and 0 deletions

View File

@ -244,6 +244,27 @@ fn lists_all_hidden_files_when_glob_does_not_contain_dot() {
})
}
#[test]
#[cfg(unix)]
fn fails_with_ls_to_dir_without_permission() {
Playground::setup("ls_test_1", |dirs, sandbox| {
sandbox.within("dir_a").with_files(vec![
EmptyFile("yehuda.11.txt"),
EmptyFile("jonathan.10.txt"),
]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
chmod 000 dir_a; ls dir_a
"#
));
assert!(actual
.err
.contains("The permissions of 0 do not allow access for this user"));
})
}
#[test]
fn lists_files_including_starting_with_dot() {
Playground::setup("ls_test_9", |dirs, sandbox| {