Sha256: eaa2d998d4b0dd0a49e9a9ba9748f711d7136fc7a35d2ff750b4b83db1b03cac
Contents?: true
Size: 849 Bytes
Versions: 2
Compression:
Stored size: 849 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.nonzero? 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-1.0.0.beta2 | lib/renuo_bin_check/master_thread.rb |
renuo-bin-check-1.0.0.beta1 | lib/renuo_bin_check/master_thread.rb |