From 5fe515179564314053d17fe50ad304269f54446c Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Tue, 16 Aug 2016 11:42:23 +0100 Subject: [PATCH] Rescue EPIPE on connect in ssh transport SSH will raise an Errno::EPIPE if the remote server closes the connection unexpectedly. This can happen, for example, in cases where a user has an improperly configured ProxyCommand for that host in `~/.ssh/config`. Adding EPIPE to the set of exceptions to rescue ensures that we raise Train::Transports::SSHFailed which callers of train my already be rescuing. --- lib/train/transports/ssh_connection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/train/transports/ssh_connection.rb b/lib/train/transports/ssh_connection.rb index b5ecbd6e..d8db499b 100644 --- a/lib/train/transports/ssh_connection.rb +++ b/lib/train/transports/ssh_connection.rb @@ -166,7 +166,7 @@ def uri RESCUE_EXCEPTIONS_ON_ESTABLISH = [ Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT, - Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH, + Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH, Errno::EPIPE, Net::SSH::Disconnect, Net::SSH::AuthenticationFailed, Net::SSH::ConnectionTimeout, Timeout::Error ].freeze