How does a tool like grep know when the end of file is reached, when reading from stdin (like in foo | grep
)?
The EOF byte could belong to the original file, so it can't rely on that. Does it rely on the fact that the pipe is closed or something else?