lib/capissh/command.rb
# Processes the command in parallel on all specified hosts. If the command
# fails (non-zero return code) on any of the hosts, this will raise a
# Capissh::CommandError.
Processes the command in parallel on all specified hosts. If the command
fails (non-zero return code) on any of the hosts, this will raise a
Capissh::CommandError.
Processes the command in parallel on all specified hosts . If the command fails ( non - zero return code ) on any of the hosts this will raise a Capissh :: CommandError .
def call(sessions)
      channels = sessions.map do |session|
        open_channels(session)
      end.flatten
      elapsed = Benchmark.realtime do
        loop do
          active = sessions.process_iteration do
            channels.any? { |ch| !ch[:closed] }
          end
          break unless active
        end
      end
      logger.trace "command finished in #{(elapsed * 1000).round}ms" if logger
      failed = channels.select { |ch| ch[:status] != 0 }
      if failed.any?
        handle_failed(failed)
      end
      self
    end
def call ( sessions ) channels = sessions . map do | session | open_channels ( session ) end . flatten elapsed = Benchmark . realtime do loop do active = sessions . process_iteration do channels . any? { | ch | ! ch [ :closed ] } end break unless active end end logger . trace "command finished in #{(elapsed * 1000).round}ms" if logger failed = channels . select { | ch | ch [ :status ] != 0 } if failed . any? handle_failed ( failed ) end self end
Processes the command in parallel on all specified hosts.
Processes the command in parallel on all specified hosts .
sessions