Change to use waitForProcessOutput

This is more robust and will not throw exceptions on the streams
when we close the process forcibly after 20000 ms.