Simplified the capture_stdout manager.