Reputation: 369
This Ruby code hangs:
file = File.open('filename')
STDIN = file
do_stuff
file.close
So in Ruby, how do I redirect STDIN to a file?
Upvotes: 0
Views: 209
Reputation: 369
Ok, based on the variation link provided, I got it to work:
file = STDIN.reopen('filename')
do_stuff
file.close
Thanks!
Upvotes: 1