Method: Bj::Util::ModuleMethods#start

Defined in:
lib/bj/util.rb

#start(*a) ⇒ Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/bj/util.rb', line 54

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