Module: Chef::Mixin::PowershellOut

Instance Method Summary collapse

Methods included from WindowsArchitectureHelper

#assert_valid_windows_architecture!, #disable_wow64_file_redirection, #forced_32bit_override_required?, #is_i386_process_on_x86_64_windows?, #node_supports_windows_architecture?, #node_windows_architecture, #restore_wow64_file_redirection, #valid_windows_architecture?, #with_os_architecture, #wow64_architecture_override_required?, #wow64_directory

Methods included from ShellOut

#a_to_s, #clean_array, #shell_out, #shell_out!, #shell_out_compact, #shell_out_compact!, #shell_out_compact_timeout, #shell_out_compact_timeout!, #shell_out_with_systems_locale, #shell_out_with_systems_locale!

Methods included from PathSanity

#enforce_path_sanity, #sanitized_path

Instance Method Details

#powershell_out(*command_args) ⇒ Mixlib::Shellout

Run a command under powershell with the same API as shell_out. The options hash is extended to take an “architecture” flag which can be set to :i386 or :x86_64 to force the windows architecture.

Parameters:

  • script (String)

    script to run

  • options (Hash)

    options hash

Returns:

  • (Mixlib::Shellout)

    mixlib-shellout object



33
34
35
36
37
38
# File 'lib/chef/mixin/powershell_out.rb', line 33

def powershell_out(*command_args)
  script = command_args.first
  options = command_args.last.is_a?(Hash) ? command_args.last : nil

  run_command_with_os_architecture(script, options)
end

#powershell_out!(*command_args) ⇒ Mixlib::Shellout

Run a command under powershell with the same API as shell_out! (raises exceptions on errors)

Parameters:

  • script (String)

    script to run

  • options (Hash)

    options hash

Returns:

  • (Mixlib::Shellout)

    mixlib-shellout object



46
47
48
49
50
# File 'lib/chef/mixin/powershell_out.rb', line 46

def powershell_out!(*command_args)
  cmd = powershell_out(*command_args)
  cmd.error!
  cmd
end