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?
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?
Ok, based on the variation link provided, I got it to work:
file = STDIN.reopen('filename')
do_stuff
file.close
Thanks!