diff --git a/crates/nu-command/src/path/exists.rs b/crates/nu-command/src/path/exists.rs index e00a6c2f39..29d57f6993 100644 --- a/crates/nu-command/src/path/exists.rs +++ b/crates/nu-command/src/path/exists.rs @@ -105,7 +105,10 @@ If you need to distinguish dirs and files, please use `path type`."# fn exists(path: &Path, span: Span, args: &Arguments) -> Value { let path = expand_path_with(path, &args.pwd); Value::Bool { - val: path.exists(), + val: match path.try_exists() { + Ok(exists) => exists, + Err(err) => return Value::Error { error: err.into() }, + }, span, } }