module NodeSpec::CommandExecution

Public Instance Methods

execute_within_timeout(command, timeout = NodeSpec::RunOptions.command_timeout, &block) click to toggle source
# File lib/nodespec/command_execution.rb, line 10
def execute_within_timeout(command, timeout = NodeSpec::RunOptions.command_timeout, &block)
  verbose_puts "\nExecuting command:\n#{command}"
  command_success = Timeout::timeout(timeout, &block)
  raise CommandExecutionError.new 'The command execution failed. Enable verbosity to check the output.' unless command_success
end