Googletest export
Add a safety nullptr check to catch the case where the /tmp file used for capturing a stream cannot be created.
PiperOrigin-RevId: 250523012