StringIO for capture* methods

* less resources used
* fixes a bug when remote process generates much stderr but it's not
  being read