Method: Puppet::Util::PTomulik::Package::Ports::Execution#execute_command

Defined in:
lib/puppet/util/ptomulik/package/ports/execution.rb

#execute_command(command, options = {}) ⇒ Object

Execute command via execpipe

Parameters:

  • command (Array|String)

    command to be executed (with args) via execpipe,

  • options (Hash) (defaults to: {})

    additional options (not passed to execpipe)

Options Hash (options):

  • :execpipe (Method)

    handle to a method implementing execpipe; should have same interface as ‘Puppet::Util::Execution.execpipe`

  • :failonfail (Boolean)

    passed as failonfail argument to ‘Puppet::Util::Execution.execpipe`



51
52
53
54
55
56
# File 'lib/puppet/util/ptomulik/package/ports/execution.rb', line 51

def execute_command(command, options = {})
  executor = options[:execpipe] || method(:execpipe)
  args = [command]
  args << options[:failonfail] if options.include?(:failonfail)
  executor.call(*args) { |pipe| yield pipe }
end