Class: Async::Process::Child
- Inherits:
-
Object
- Object
- Async::Process::Child
- Defined in:
- lib/sc2ai/overrides/async/process/child.rb
Instance Method Summary collapse
-
#initialize(*args, **options) ⇒ Child
constructor
A new instance of Child.
Constructor Details
#initialize(*args, **options) ⇒ Child
Returns a new instance of Child.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sc2ai/overrides/async/process/child.rb', line 8 def initialize(*args, **) # Setup a cross-thread notification pipe - nio4r can't monitor pids unfortunately: pipe = ::IO.pipe @input = pipe.first @output = pipe.last @exit_status = nil if Gem.win_platform? [:new_pgroup] = true else [:pgroup] = true end @pid = ::Process.spawn(*args, **) @thread = Thread.new do _, @exit_status = ::Process.wait2(@pid) @output.close end end |