Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thenoseman/437598 to your computer and use it in GitHub Desktop.
Save thenoseman/437598 to your computer and use it in GitHub Desktop.
capistrano non-parallel patch
diff -rupN capistrano-2.5.18-unpatched/lib/capistrano/command.rb capistrano-2.5.18/lib/capistrano/command.rb
--- capistrano-2.5.18-unpatched/lib/capistrano/command.rb 2010-06-08 10:30:11.000000000 +0200
+++ capistrano-2.5.18/lib/capistrano/command.rb 2010-05-21 10:34:31.000000000 +0200
@@ -191,7 +191,7 @@ module Capistrano
end
def open_channels
- sessions.map do |session|
+ sessions.compact.map do |session|
server = session.xserver
tree.branches_for(server).map do |branch|
session.open_channel do |channel|
diff -rupN capistrano-2.5.18-unpatched/lib/capistrano/configuration/connections.rb capistrano-2.5.18/lib/capistrano/configuration/connections.rb
--- capistrano-2.5.18-unpatched/lib/capistrano/configuration/connections.rb 2010-06-08 10:30:11.000000000 +0200
+++ capistrano-2.5.18/lib/capistrano/configuration/connections.rb 2010-05-21 10:35:31.000000000 +0200
@@ -104,8 +104,8 @@ module Capistrano
# each connection is done in parallel.
connection_factory
- threads = Array(servers).map { |server| establish_connection_to(server, failed_servers) }
- threads.each { |t| t.join }
+ Array(servers).each { |server| establish_connection_to(server, failed_servers) }
+
if failed_servers.any?
errors = failed_servers.map { |h| "#{h[:server]} (#{h[:error].class}: #{h[:error].message})" }
@@ -188,8 +188,8 @@ module Capistrano
# prevents problems with the thread's scope seeing the wrong 'server'
# variable if the thread just happens to take too long to start up.
def establish_connection_to(server, failures=nil)
- current_thread = Thread.current
- Thread.new { safely_establish_connection_to(server, current_thread, failures) }
+ current_thread ||= Thread.current
+ safely_establish_connection_to(server, current_thread, failures)
end
def safely_establish_connection_to(server, thread, failures=nil)
diff -rupN capistrano-2.5.18-unpatched/lib/capistrano/processable.rb capistrano-2.5.18/lib/capistrano/processable.rb
--- capistrano-2.5.18-unpatched/lib/capistrano/processable.rb 2010-06-08 10:30:11.000000000 +0200
+++ capistrano-2.5.18/lib/capistrano/processable.rb 2010-05-21 10:36:02.000000000 +0200
@@ -38,7 +38,7 @@ module Capistrano
def ensure_each_session
errors = []
- sessions.each do |session|
+ sessions.compact.each do |session|
begin
yield session
rescue Exception => error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment