Added IO mocking to ScratchContainer for tidiness.

Capturing stderr removes many warnings from test output.