Sha256: c64a2c339663d4d2429226e8b38f989fa152b877db1e5954328f4828fe6ad7ba
Contents?: true
Size: 845 Bytes
Versions: 2
Compression:
Stored size: 845 Bytes
Contents
require 'thwait' module RenuoBinCheck class MasterThread attr_reader :threads, :printer def initialize(printer) @threads = [] @results = [] @printer = printer end def add_thread(script_config) threads << Thread.new do servant = ServantThread.new(script_config) Thread.current[:result] = servant.run end end def finalize waiter = ThreadsWait.new(threads) until waiter.empty? result = waiter.next_wait[:result] @results << result exit_with_error(result) if result.exit_code == 1 end exit_with_success end private def exit_with_error(result) @printer.print_error_output(result) exit 1 end def exit_with_success @printer.print_standard_output(@results) exit 0 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
renuo-bin-check-0.2.1 | lib/renuo_bin_check/master_thread.rb |
renuo-bin-check-0.2.0 | lib/renuo_bin_check/master_thread.rb |