Module: R10K::Execution
- Includes:
- Logging
- Defined in:
- lib/r10k/execution.rb
Overview
:nocov:
Constant Summary
Constants included from Logging
Instance Method Summary collapse
-
#execute(cmd, opts = {}) ⇒ String
Execute a command and return stdout.
Methods included from Logging
formatter, included, level, level=, levels, #logger, #logger_name, outputter, parse_level
Instance Method Details
#execute(cmd, opts = {}) ⇒ String
Execute a command and return stdout
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/r10k/execution.rb', line 22 def execute(cmd, opts = {}) logger.warn "R10K::Execution#execute is deprecated, use R10K::Util::Subprocess" event = (opts.delete(:event) || cmd) logger.debug1 "Execute: #{event.inspect}" status, stdout, stderr = systemu(cmd, opts) logger.debug2 "[#{event}] STDOUT: #{stdout.chomp}" unless stdout.empty? logger.debug2 "[#{event}] STDERR: #{stderr.chomp}" unless stderr.empty? unless status == 0 msg = "#{cmd.inspect} returned with non-zero exit value #{status.exitstatus}" e = R10K::ExecutionFailure.new(msg) e.exit_code = status e.stdout = stdout e.stderr = stderr raise e end stdout end |