mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-06-14 22:15:13 +02:00
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
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user