mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
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:
@ -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| {
|
||||
|
Reference in New Issue
Block a user