Refactored subprocess to support more IO redirect modes.

Review: https://reviews.apache.org/r/22688
Updated mesos to use the new Subprocess API.

Review: https://reviews.apache.org/r/22702