net-ssh/net-scp — pull request #10 by jkeiser (2013-12-19 03:01:43+00:00)
Title: Get the error string during download

When a download fails, ssh servers send Net::SCP.download a directive containing the error message. Net::SCP throws an exception when processing it. The exception is not always processed, either. This causes two issues:

1. The error message does not show up in the Net::SCP::Error that is thrown when the download fails
2. The channel remains open even though Net::SCP.download()'s wait() has finished, so the next time someone else uses the same channel for a different purpose, *they* get the exception thrown.

This fixes the issue by processing the error message, and making sure that even if process() is not called on the channel, the message gets processed on_close. It also adds a test which should illustrate what the protocol looks like in the case of an error.