Capturing stdout in a string