summaryrefslogtreecommitdiff
path: root/lib/chef/provider/powershell_script.rb
diff options
context:
space:
mode:
authorSalim Alam <salam@chef.io>2015-08-13 14:25:48 -0700
committerSalim Alam <salam@chef.io>2015-08-19 11:08:17 -0700
commit6c4cd5c6d5c40baca723bf95cdbccdda59021198 (patch)
treef2d6357705440c11467b46c60eac0b4c5ddb871e /lib/chef/provider/powershell_script.rb
parentfe6676bab51390429674b0ecd4670924ffb09cc5 (diff)
downloadchef-6c4cd5c6d5c40baca723bf95cdbccdda59021198.tar.gz
Enable 64-bit support for Powershell and Batch scripts
Diffstat (limited to 'lib/chef/provider/powershell_script.rb')
-rw-r--r--lib/chef/provider/powershell_script.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index 3c52db1f33..004b182769 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -34,6 +34,15 @@ class Chef
super
end
+ def command
+ basepath = is_forced_32bit ? wow64_directory : run_context.node.kernel.os_info.system_directory
+
+ # Powershell.exe is always in "v1.0" folder (for backwards compatibility)
+ interpreter_path = Chef::Util::PathHelper.join(basepath, "WindowsPowerShell", "v1.0", interpreter)
+
+ "\"#{interpreter_path}\" #{flags} \"#{script_file.path}\""
+ end
+
def flags
# Must use -File rather than -Command to launch the script
# file created by the base class that contains the script