diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2021-11-02 21:37:14 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2021-11-03 16:51:00 -0700 |
commit | 82c21c7ed130fec1208ee96699725cd729029616 (patch) | |
tree | e0a1d0e9b743dfa4d3cb94e24df37efa1ff82a7a /lib/chef/powershell.rb | |
parent | c471231140d55ace1a5bf27c9fa9e41f4dd5ec8c (diff) | |
download | chef-82c21c7ed130fec1208ee96699725cd729029616.tar.gz |
Clear up some more -1's
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
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 4be80b56b7..399b631633 100644 --- a/lib/chef/powershell.rb +++ b/lib/chef/powershell.rb @@ -35,7 +35,7 @@ class Chef # @param script [String] script to run # @param timeout [Integer, nil] timeout in seconds. # @return [Object] output - def initialize(script, timeout: nil) + def initialize(script, timeout: -1) # This Powershell DLL source lives here: https://github.com/chef/chef-powershell-shim # Every merge into that repo triggers a Habitat build and promotion. Running # the rake :update_chef_exec_dll task in this (chef/chef) repo will pull down @@ -67,10 +67,10 @@ class Chef private - def exec(script, timeout: nil) + def exec(script, timeout: -1) FFI.ffi_lib @dll FFI.attach_function :execute_powershell, :ExecuteScript, %i{string int}, :pointer - timeout = timeout&.nonzero? ? timeout : -1 + timeout = -1 if timeout == 0 || timeout.nil? execution = FFI.execute_powershell(script, timeout).read_utf16string hashed_outcome = Chef::JSONCompat.parse(execution) @result = Chef::JSONCompat.parse(hashed_outcome["result"]) |