Browse files

Since cygwin's ssh is buggy, try until it works

  • Loading branch information...
1 parent c7fa994 commit 40e1b6bf477c2a8312a6a90e76c64663bc8bb9aa @nilbus nilbus committed Feb 24, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 lib/capistrano/ext/windows_server.rb
View
16 lib/capistrano/ext/windows_server.rb
@@ -67,7 +67,21 @@ def gemfile_present?
if ! /bin/grep '#{alter_path_cmd}' ~/.bashrc > /dev/null; then echo '#{alter_path_cmd}' >> ~/.bashrc; fi
RUN
- strategy.send 'update_repository_cache'
+ continue = true
+ while continue
+ begin
+ strategy.send 'update_repository_cache'
+ continue = false
+ rescue
+ puts "Failed to check out git. If the error was 'fatal: The remote end hung up unexpectedly', this is due to a cygwin ssh bug."
+ puts "It often works to just try again repeatedly (a lot! 30+ times for an initial clone - it's like playing the lottery :-)"
+ @try_again_response ||= Capistrano::CLI.ui.ask("Keep trying? [Y/n]: ").to_s.chomp
+ unless @try_again_response.empty? || @try_again_response.downcase == 'y'
+ continue = false
+ raise $!
+ end
+ end
+ end
finalize_update
end

0 comments on commit 40e1b6b

Please sign in to comment.