Small refactor of getting temporary streams for STDOUT and STDERR.