Use globals rather than constants for IO

Normally STDOUT == $stdout so they can be used interchangably. Trying to
test the captured output and it is inconsistent because we are logging
to either STDOUT or $stdout (or the err version).

This makes it impossible to capture ALL output and check since the IO is
a mixture.

We can't cleanly reset the constants so using the globals.
Creates a FauxIO class to capture std IO for tests

This is an expanded version of the `capture_stdout` tool that captures
both stdout and stderr and can cope with Kernel exit.
Replace uses of capture_std* with FauxIO

Both helpers do the same job but FauxIO can capture both stderr and
stdout for the same block which can be useful when data / warnings mix