Fixed data in pipe being truncated if not read before process termination
Fixed overly complex code.  Added test to ensure all process output is read.