I have numbers.rb
loop do
puts rand(10)
sleep(1)
end
I have pipe.rb
ARGF.each_line do |line|
puts "received #{line}"
end
I'm trying to pipe output of number.rb to pipe.rb. Like this –
ruby lib/numbers.rb | ruby pipe.rb
However, this doesn't do what I want it to do. Basically, the piped input doesn't seem to be recieved until the process number.rb stops executing. But numbers.rb isn't supposed to end. How do I pipe the stdout of numbers.rb continuously, as it happens, to pipe.rb?