Module: Mixlib::ShellOut::Helper

Includes:
ChefUtils::DSL::DefaultPaths, ChefUtils::Internal
Defined in:
lib/mixlib/shellout/helper.rb

Defined Under Namespace

Classes: FakeShellOut

Instance Method Summary collapse

Instance Method Details

#shell_out(*args, **options) ⇒ Object

These APIs are considered public for use in ohai and chef (by cookbooks and plugins, etc) but are considered private/experimental for now for the direct users of mixlib-shellout.

You can see an example of how to handle the “dependency injection” in the rspec unit test. That backend API is left deliberately undocumented for now and may not follow SemVer and may break at any time (at least for the rest of 2020).



38
39
40
41
42
43
44
45
46
# File 'lib/mixlib/shellout/helper.rb', line 38

def shell_out(*args, **options)
  options = options.dup
  options = __maybe_add_timeout(self, options)
  if options.empty?
    shell_out_compacted(*__clean_array(*args))
  else
    shell_out_compacted(*__clean_array(*args), **options)
  end
end

#shell_out!(*args, **options) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/mixlib/shellout/helper.rb', line 48

def shell_out!(*args, **options)
  options = options.dup
  options = __maybe_add_timeout(self, options)
  if options.empty?
    shell_out_compacted!(*__clean_array(*args))
  else
    shell_out_compacted!(*__clean_array(*args), **options)
  end
end