forked from extern/nushell
use path.try_exist() to fix silent errors (#7069)
This commit is contained in:
parent
7b0c0692dc
commit
457f7889df
@ -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,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user