Moving exit code to the context allows error handling routines to
rely only on the context.
Moving stdout and stderr streams to the context allows mocking in
unit tests, and allows sending output to a buffer for pre-processing
when we implement interactive mode.
refs #3864
Change-Id: Ibf59c12405d0eaca0597835cb2e30125b7f70adb