From 457f7889df2efd6509cd07ddec95b680cc1f10ab Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Wed, 9 Nov 2022 18:54:43 -0600 Subject: [PATCH] use path.try_exist() to fix silent errors (#7069) --- crates/nu-command/src/path/exists.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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, } }