Add logic for separating stdout and stderr. This solution is commented out with #if 0 right now although it has been tested and is fully functional.
The default implementation is to merge stdout and stderr into a single stream.