Context to redirect stdout (inspired by a tutorial by Eli Bendersky)
Adapted by Peter Duerr
Redirect standard out and err to a buffer
Redirects standard out to a buffer