Fix slow ssh

We break the read while loop after waiting "the end of the process" and
the pipes are empty, otherwise we do another select that waits all the
timeout.
Merge pull request #5879 from lberruti/ssh_slow_fix

Fix slow ssh