Reputation: 11687
I have such server schema:
sleep 5
puts 'Server started'
loop { }
When I run it in irb:
arr = Open3.popen3('ruby server.rb') arr[1].gets
the gets blocks, and even I know it should return 'Server started' it does not.
When I interrupt it and call arr[1].gets
again, it returns 'Server started' immediately.
How to make it return output on first arr[1].gets
?
PS. When I remove loop { }
from server it works perfectly.
Upvotes: 1
Views: 142