Capture stdout.