Class: Bbq::Spawn::CoordinatedExecutor
- Inherits:
-
Object
- Object
- Bbq::Spawn::CoordinatedExecutor
- Extended by:
- Forwardable
- Defined in:
- lib/bbq/spawn.rb
Instance Method Summary collapse
-
#initialize(executor, options = {}) ⇒ CoordinatedExecutor
constructor
A new instance of CoordinatedExecutor.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(executor, options = {}) ⇒ CoordinatedExecutor
Returns a new instance of CoordinatedExecutor.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bbq/spawn.rb', line 27 def initialize(executor, = {}) @executor = executor @timeout = .fetch(:timeout, 10) @banner = [:banner] @host = [:host] @port = [:port] @url = [:url] @reader, @writer = IO.pipe end |
Instance Method Details
#join ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/bbq/spawn.rb', line 44 def join Timeout.timeout(@timeout) do wait_for_io if @banner wait_for_socket if @port and @host wait_for_response if @url end rescue Timeout::Error end |
#start ⇒ Object
38 39 40 41 42 |
# File 'lib/bbq/spawn.rb', line 38 def start @executor.io.stdout = @executor.io.stderr = @writer @executor.start @writer.close end |