WIP: partial fix for #9244, a hack to handle uninitialized stdio.

The proper solution will, I'm sure, at least include proper cleanup, but this hack was sufficient to get my simple use case working for me.