Thursday, 12 September 2013

$stdout puts not working

$stdout puts not working

Hey I'm reading the Well-Grounded Rubyist and I can't seem to get the file
output to work correctly.
record = File.open("/tmp/record", "w")
old_stdout = $stdout
$stdout = record
$stderr = $stdout
puts "This is a record"
z = 10/0
I can't seem to get the output to a file when I run it from command line
or pry. Any ideas why this wouldn't work?

No comments:

Post a Comment