Skip to content

Commit

Permalink
Turn "prefix directory not found" into empty list return.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobhy committed Sep 29, 2023
1 parent f8b53bf commit b1d8dc2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/nu-command/src/filesystem/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ impl Command for Glob {
let path = current_dir(engine_state, stack)?;
let path = match nu_path::canonicalize_with(prefix, path) {
Ok(path) => path,
Err(e) if e.to_string().contains("os error 2") => std::path::PathBuf::new(),
Err(e) if e.to_string().contains("os error 2") =>
// path we're trying to glob doesn't exist,
{
std::path::PathBuf::new() // user should get empty list not an error
}
Err(e) => {
return Err(ShellError::GenericError(
"error in canonicalize".to_string(),
Expand Down

0 comments on commit b1d8dc2

Please sign in to comment.