diff options
author | Andrew Gallant <jamslam@gmail.com> | 2024-02-15 11:59:59 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2024-02-15 11:59:59 -0500 |
commit | 4a30819302810a8772bd205970d41fe9b4e97333 (patch) | |
tree | 884ad44d91c9e528d8694b5fd1fe47c90f577402 /crates/cli/src/lib.rs | |
parent | 9b42af96f0143a395b9379b6c761b5625367a3b9 (diff) |
cli: tweak how "is one file" predicate works
In effect, we switch from `path.is_file()` to `!path.is_dir()`. In cases
where process substitution is used, for example, the path can actually
have type "fifo" instead of "file." Even if it's a fifo, we want to
treat it as-if it were a file. The real key here is that we basically
always want to consider a lone argument as a file so long as we know it
isn't a directory. Because a directory is the only thing that will
causes us to (potentially) search more than one thing.
Fixes #2736
Diffstat (limited to 'crates/cli/src/lib.rs')
-rw-r--r-- | crates/cli/src/lib.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index 643d796c..3cc6636a 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -182,6 +182,7 @@ pub fn is_readable_stdin() -> bool { let file = File::from(fd); let Ok(md) = file.metadata() else { return false }; let ft = md.file_type(); + dbg!(&ft); ft.is_file() || ft.is_fifo() || ft.is_socket() } |