summaryrefslogtreecommitdiff
path: root/crates/nu-command/src/filesystem/ls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/nu-command/src/filesystem/ls.rs')
-rw-r--r--crates/nu-command/src/filesystem/ls.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/nu-command/src/filesystem/ls.rs b/crates/nu-command/src/filesystem/ls.rs
index a9e98885e..0fa94e1cc 100644
--- a/crates/nu-command/src/filesystem/ls.rs
+++ b/crates/nu-command/src/filesystem/ls.rs
@@ -147,9 +147,13 @@ impl Command for Ls {
Some(glob_options)
};
let (prefix, paths) =
- nu_engine::glob_from(&glob_path, &cwd, call_span, glob_options)
- .expect("glob failure");
-
+ match nu_engine::glob_from(&glob_path, &cwd, call_span, glob_options) {
+ Ok((prefix, paths)) => (prefix, paths),
+ Err(e) => {
+ shell_errors.push(e);
+ return Vec::from([Value::nothing(call_span)]).into_iter();
+ }
+ };
let mut paths_peek = paths.peekable();
if paths_peek.peek().is_none() {
shell_errors.push(ShellError::GenericError(