Module: VSM::Executors::ThreadExecutor

Defined in:
lib/vsm/executors/thread_executor.rb

Class Method Summary collapse

Class Method Details

.call(tool, args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/vsm/executors/thread_executor.rb', line 5

def self.call(tool, args)
  q = Queue.new
  Thread.new do
    begin
      q << [:ok, tool.run(args)]
    rescue => e
      q << [:err, e]
    end
  end
  tag, val = q.pop
  tag == :ok ? val : raise(val)
end