Module: Vx::Lib::Spawn::Process

Extended by:
Process
Included in:
Process
Defined in:
lib/vx/lib/spawn/process.rb

Instance Method Summary collapse

Instance Method Details

#spawn(command, options = {}, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vx/lib/spawn/process.rb', line 12

def spawn(command, options = {}, &block)
  select_timeout = options.delete(:pool_interval) || Spawn.pool_interval
  timeout        = Spawn::Timeout.new options.delete(:timeout)
  read_timeout   = Spawn::ReadTimeout.new options.delete(:read_timeout)

  status = spawn_command_internal(command, options) do |r|
    read_loop r, timeout, read_timeout, select_timeout, &block
  end

  compute_exit_code command, status, timeout, read_timeout
end