Skip to content

Commit

Permalink
[COOK-581] force 64-bit powershell process from 32-bit ruby processes
Browse files Browse the repository at this point in the history
  • Loading branch information
schisamo committed Jun 14, 2011
1 parent e1e3f1b commit c6df826
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion powershell/libraries/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,21 @@ def initialize(name, run_context=nil)
super
@resource_name = :powershell
@provider = Chef::Provider::PowershellScript
@interpreter = "powershell.exe"
@interpreter = locate_powershell_interperter
@returns = [0,42] # successful commands return exit code 42
end

private
def locate_powershell_interperter
# force 64-bit powershell from 32-bit ruby process
if ::File.exist?("c:/windows/sysnative/WindowsPowershell/v1.0/powershell.exe")
"c:/windows/sysnative/WindowsPowershell/v1.0/powershell.exe"
elsif ::File.exist?("c:/windows/system32/WindowsPowershell/v1.0/powershell.exe")
"c:/windows/system32/WindowsPowershell/v1.0/powershell.exe"
else
"powershell.exe"
end
end
end
end

Expand Down

0 comments on commit c6df826

Please sign in to comment.