Circular stdio

This allows us to do partial sends which makes things a bit more robust
against buffer overruns.