Fix #299 and #260

Some processes close their output channels and IO.select keeps
returning them as "readable", while IO#gets returns nil on them, thus
spending a lot of CPU looping through the same reader continuously
Merge pull request #303 from fxposter/master

Fix for high CPU load. Fixes #260 and #299.