Method: Bj::Util::ModuleMethods#start

Defined in:
lib/bj/util.rb

#start(*a) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/bj/util.rb', line 32

def start *a 
  q = Queue.new
  thread = Thread.new do
    Thread.current.abort_on_exception = true
    systemu(*a){|pid| q << pid}
  end
  pid = q.pop
  thread.singleton_class{ define_method(:pid){ pid } }
  thread
end