Module: NodeSpec::CommandExecution

Includes:
VerboseOutput
Included in:
BackendProxy::Base, LocalCommandRunner
Defined in:
lib/nodespec/command_execution.rb

Defined Under Namespace

Classes: CommandExecutionError

Instance Method Summary collapse

Methods included from VerboseOutput

#verbose_puts

Instance Method Details

#execute_within_timeout(command, timeout = NodeSpec::RunOptions.command_timeout, &block) ⇒ Object



10
11
12
13
14
# 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