lib/r10k/execution.rb in r10k-1.1.4 vs lib/r10k/execution.rb in r10k-1.2.0rc1
- old
+ new
@@ -11,21 +11,24 @@
#
# @params [String] cmd
# @params [Hash] opts
#
# @option opts [String] :event An optional log event name. Defaults to cmd.
+ # @option opts [String] :cwd The working directory to use when executing the command
#
# @raise [R10K::ExecutionFailure] If the executed command exited with a
# nonzero exit code.
#
# @return [String] the stdout from the command
def execute(cmd, opts = {})
- event = opts[:event] || cmd
+ 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)
+ 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