Sorry if this is a naïve question, but let's say I have a Ruby program called processor.rb
that begins with data = STDIN.read
. If I invoke this program like this
cat textfile.txt | processor.rb
Does STDIN.read
wait for cat
to pipe the entire textfile.txt
in? Or does it assign some indeterminate portion of textfile.txt
to the data
variable?
I'm asking this because I recently saw a strange bug in one of my programs that suggests that the latter is the case.