diff options
author | mwrock <matt@mattwrock.com> | 2020-09-30 17:34:29 -0700 |
---|---|---|
committer | mwrock <matt@mattwrock.com> | 2020-10-01 16:32:54 -0700 |
commit | 9833cc34a88ef149c8a8565880440102068345bb (patch) | |
tree | 617d23dd2050343b6ae6a94b18c9dc058ec660b4 /lib/chef/powershell.rb | |
parent | 6b077d998a0c3168cb7edb19d9d70d122ecafc95 (diff) | |
download | chef-9833cc34a88ef149c8a8565880440102068345bb.tar.gz |
add interpreter arg to powershell_exec allowing it to run powershell core
Signed-off-by: mwrock <matt@mattwrock.com>
Diffstat (limited to 'lib/chef/powershell.rb')
-rw-r--r-- | lib/chef/powershell.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/powershell.rb b/lib/chef/powershell.rb index 10765384ff..70905ba7ba 100644 --- a/lib/chef/powershell.rb +++ b/lib/chef/powershell.rb @@ -35,7 +35,7 @@ class Chef # @return [Object] output def initialize(script) raise "Chef::PowerShell can only be used on the Windows platform." unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/) - + @dll ||= "Chef.PowerShell.Wrapper.dll" exec(script) end @@ -59,10 +59,10 @@ class Chef raise Chef::PowerShell::CommandFailed, "Unexpected exit in PowerShell command: #{@errors}" if error? end - private + protected def exec(script) - FFI.ffi_lib "Chef.PowerShell.Wrapper.dll" + FFI.ffi_lib @dll FFI.attach_function :execute_powershell, :ExecuteScript, [:string], :pointer execution = FFI.execute_powershell(script).read_utf16string hashed_outcome = Chef::JSONCompat.parse(execution) |