From 82c21c7ed130fec1208ee96699725cd729029616 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 2 Nov 2021 21:37:14 -0700 Subject: Clear up some more -1's Signed-off-by: Lamont Granquist --- lib/chef/powershell.rb | 6 +++--- 1 file 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"]) -- cgit v1.2.1