IO#reopen to take
class IO
begin
end
puts “normal stuff 2”
File.open(‘error_log_4’, ‘w’) do |log_file|
$stderr.reopen(‘error_log_5’, ‘w’) do
$stderr.puts “Stuff on error 5”
puts “normal stuff 5”
raise “This message courtesy of raise”
end
rescue => e
puts e
endend
Awesome. Now, can we break this with threads? Aredridel?
Of course, I wonder if IO#reopen is thread safe anyway, regardless of
the block. I’ve never seriously tested it.
Regards,
Dan
This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
destroy
all copies of the communication and any attachments.