In what scenario would stdin come from a socket? #2448
-
Hello everyone, I am a Python programmer trying to learn Rust. I like to learn by studying well made projects and for Rust I am using the ripgrep project to learn the language (Thank you BurntSushi for leaving this open source!) I started with the grep-cli crate and just from digging into it's functions I realize there are a lot of low level concepts that I need to understand. The first function I started with is the "pub fn is_readable_stdin()" (in crates/cli/src/lib.rs) and that took me on a whole journey of a basic understanding what file descriptors are, how inter-process communications work and how everything is a file in Unix. For now I understand why piping ( cat test.txt | rg "test file") and stdin redirection (rg "test file" < test.txt) make is_stdin_readable() true. But there is also a check to see if stdin is coming from a socket (ft.is_socket()) but I am getting stuck trying to find an example where that would be applicable. From https://unix.stackexchange.com/questions/16311/what-is-a-socket:
And there are examples of opening a socket |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is the commit that added the The commit message also basically answers your question. It sounds like PowerShell uses a socket instead of a fifo. I do not know why it's implemented that way. See also #1741, which is where the bug was originally reported. |
Beta Was this translation helpful? Give feedback.
This is the commit that added the
ft.is_socket()
predicate: 020c545The commit message also basically answers your question. It sounds like PowerShell uses a socket instead of a fifo. I do not know why it's implemented that way.
See also #1741, which is where the bug was originally reported.