mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2024-12-12 19:18:24 +02:00
cli: fix stdin detection for Powershell on Unix
It seems that PowerShell uses sockets instead of FIFOs to redirect the output between commands. So add `is_socket` to our `is_readable_stdin` check. This seems unlikely to cause problems and it probably more generally correct than what we had before. In theory, it could cause problems if it produces false positives, in which case, ripgrep will try to read stdin when it should search the current working directory. (And this usually winds up manifesting as ripgrep blocking forever.) But, if the stdin handle reports itself as a socket, then it seems like we should read it. Fixes #1741, Closes #1742
This commit is contained in:
parent
873abecbf1
commit
020c5453a5
@ -19,6 +19,8 @@ Bug fixes:
|
||||
|
||||
* [BUG #1277](https://github.com/BurntSushi/ripgrep/issues/1277):
|
||||
Document cygwin path translation behavior in the FAQ.
|
||||
* [BUG #1741](https://github.com/BurntSushi/ripgrep/issues/1741):
|
||||
Fix stdin detection when using PowerShell in UNIX environments.
|
||||
|
||||
|
||||
12.1.1 (2020-05-29)
|
||||
|
@ -210,7 +210,7 @@ pub fn is_readable_stdin() -> bool {
|
||||
Err(_) => return false,
|
||||
Ok(md) => md.file_type(),
|
||||
};
|
||||
ft.is_file() || ft.is_fifo()
|
||||
ft.is_file() || ft.is_fifo() || ft.is_socket()
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
|
Loading…
Reference in New Issue
Block a user