diff --git a/crates/nu-command/tests/commands/ls.rs b/crates/nu-command/tests/commands/ls.rs index e78a982791..e9f13cccb7 100644 --- a/crates/nu-command/tests/commands/ls.rs +++ b/crates/nu-command/tests/commands/ls.rs @@ -259,9 +259,20 @@ fn fails_with_ls_to_dir_without_permission() { chmod 000 dir_a; ls dir_a "# )); - assert!(actual - .err - .contains("The permissions of 0 do not allow access for this user")); + + let check_not_root = nu!( + cwd: dirs.test(), pipeline( + r#" + id -u + "# + )); + + assert!( + actual + .err + .contains("The permissions of 0 do not allow access for this user") + || check_not_root.out == "0" + ); }) }