Allow access to stdout, stderr and exit status when capturing output

This is a cleaned up and rebased version of #61

The return value of capture() is extended with accessor methods for stdout, stderr and exit status.

To use this capture() needs to be passed the raise_on_non_zero_exit:false option