I am accessing a C function in Ruby through FFI. The function is called AllocTilts::summary
.
I want the method to not print anything to STDOUT. However my temporary redirect of STDOUT is not working. Is there something else I can do?
puts 'test outside before' #prints successfully
File.open("/var/alloc_tilts/summary_dump", "w") do |out|
stdout, $stdout = $stdout, out
puts 'test inside' #doesn't print to STDOUT as expected
AllocTilts.summary(2012, 2011) #prints undesired stuff to STDOUT
$stdout = stdout
end
puts 'test outside after' #prints successfully