Avoid deadlocks in popen3
When there is a lot of stderr and/or stdout output from the file opened by popen3, then the app can deadlock and hang forever unless the pipes are drained without blocking.
See the note in the Ruby docs around the usage of popen3:
https://docs.ruby-lang.org/en/2.0.0/Open3.html#method-i-popen3
Edited by Luke Duncalfe