Redirect STDOUT for Rake ?


I'm trying to capture the output of my rake tasks/tests and can't seem to get this working. At the top of my Rake file I've got:

$stdout =

I also put it after loading 'rake/testtask' but I get the same thing, which is Rake is seemingly un-altered. The output stil goes straight to the console. How can I capture this output into my own IO objects?

Thanks, Matt