diff options
author | mwrock <matt@mattwrock.com> | 2020-10-01 17:20:52 -0700 |
---|---|---|
committer | mwrock <matt@mattwrock.com> | 2020-10-01 17:20:52 -0700 |
commit | 751bd6577681aa3d5db9273c4edb007e8136f940 (patch) | |
tree | 2b22289f13c3da428ed5b289154e30ace90083c5 /lib/chef/pwsh.rb | |
parent | 66c5129dead55431dd038eee56af2ace93e810f1 (diff) | |
download | chef-751bd6577681aa3d5db9273c4edb007e8136f940.tar.gz |
use class method instead of class varexec_core
Signed-off-by: mwrock <matt@mattwrock.com>
Diffstat (limited to 'lib/chef/pwsh.rb')
-rw-r--r-- | lib/chef/pwsh.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/chef/pwsh.rb b/lib/chef/pwsh.rb index d7604b4422..41087e3541 100644 --- a/lib/chef/pwsh.rb +++ b/lib/chef/pwsh.rb @@ -18,8 +18,6 @@ class Chef class Pwsh < Chef::PowerShell - @@wrapper_dll ||= Dir.glob("#{RbConfig::CONFIG["bindir"]}/**/Chef.PowerShell.Wrapper.Core.dll").last - # Run a command under pwsh (powershell core) via FFI # This implementation requires the managed dll, native wrapper and a # published, self contained dotnet core directory tree to exist in the @@ -28,7 +26,7 @@ class Chef # @param script [String] script to run # @return [Object] output def initialize(script) - @dll = @@wrapper_dll + @dll = Pwsh.dll super end @@ -55,5 +53,9 @@ class Chef ENV["DOTNET_MULTILEVEL_LOOKUP"] = original_dml ENV["DOTNET_ROOT"] = original_dotnet_root end + + def self.dll + @dll ||= Dir.glob("#{RbConfig::CONFIG["bindir"]}/**/Chef.PowerShell.Wrapper.Core.dll").last + end end end |