Class: Polytrix::Executors::BuffShellOutExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/polytrix/executors/buff_shellout_executor.rb

Instance Method Summary collapse

Instance Method Details

#execute(command, opts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/polytrix/executors/buff_shellout_executor.rb', line 6

def execute(command, opts)
  cwd = opts.delete(:cwd) || Dir.pwd
  execution_result = nil
  Dir.chdir(cwd) do
    shell = Buff::ShellOut.shell_out(command)
    # Buff doesn't have a live_stream like Mixlib
    puts shell.stdout if Polytrix.configuration.log_level == :debug
    execution_result = ExecutionResult.new exitstatus: shell.exitstatus, stdout: shell.stdout, stderr: shell.stderr
  end
  execution_result
end