class Omnitest::Shell::MixlibShellOutExecutor
Constants
- MIXLIB_SHELLOUT_EXCEPTION_CLASSES
Attributes
shell[R]
Public Instance Methods
execute(command, opts = {})
click to toggle source
# File lib/omnitest/shell/mixlib_shellout_executor.rb, line 36 def execute(command, opts = {}) # rubocop:disable Metrics/AbcSize opts[:cwd] = (opts[:cwd] || Dir.pwd).to_s @logger = opts.delete(:logger) || logger @shell = Mixlib::ShellOut.new(command, opts) @shell.live_stream = IOToLog.new(@logger) Bundler.with_clean_env do @shell.run_command end execution_result rescue SystemCallError, *MIXLIB_SHELLOUT_EXCEPTION_CLASSES, TypeError => e # See https://github.com/opscode/mixlib-shellout/issues/62 execution_error = ExecutionError.new(e) execution_error.execution_result = execution_result raise execution_error end
Private Instance Methods
execution_result()
click to toggle source
# File lib/omnitest/shell/mixlib_shellout_executor.rb, line 54 def execution_result return nil if shell.nil? ExecutionResult.new( command: shell.command, exitstatus: shell.exitstatus, stdout: shell.stdout, stderr: shell.stderr ) end