nushell/crates/nu-command/tests/commands/path
Wind 217eb4ed70
fix path exists on a non-directory file (#13763)
# Description
Fixes:  #13460

The issue is caused by `try_exists` method on path, it will return
`Err(NotADirectory)` if user tried to check for a path under a regular
file.
To fix it, I think it's ok to use `exists` rather than `try_exists`,
although
[Path::exists()](https://doc.rust-lang.org/std/path/struct.Path.html#method.exists)
only checks whether or not a path was both found and readable. I think
it's ok, and we can add this information under `extra_description`.

# User-Facing Changes
The following code will no longer raise error:
```
touch a; 'a/b' | path exists
```

# Tests + Formatting
Added 1 test.
2024-09-11 12:45:39 -05:00
..
basename.rs Add long options for path (#10775) 2023-10-19 22:07:01 +02:00
dirname.rs Add long options for path (#10775) 2023-10-19 22:07:01 +02:00
exists.rs fix path exists on a non-directory file (#13763) 2024-09-11 12:45:39 -05:00
expand.rs Path migration part 4: various tests (#13373) 2024-08-03 10:09:13 +02:00
join.rs Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00
mod.rs remove warnings in nu_command tests (#10145) 2023-08-29 13:18:52 -07:00
parse.rs bump rust-toolchain to 1.72.1 (#11079) 2023-11-16 15:14:45 -06:00
split.rs Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00
type_.rs Fix path type using PWD from the environment (#12975) 2024-05-26 20:23:52 +03:00