summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvasu1105 <vasundhara.jagdale@msystechnologies.com>2018-05-17 17:51:42 +0530
committervasu1105 <vasundhara.jagdale@msystechnologies.com>2018-05-17 17:53:51 +0530
commita6c3be3c9f19bfe242a99276a58e56d07e78e798 (patch)
tree0ffba51b6be9c1de226b30b1b30bf1ed2a17cc45
parent985488397c1b8d4c1cab0a6a6613f17665311211 (diff)
downloadchef-a6c3be3c9f19bfe242a99276a58e56d07e78e798.tar.gz
[MSYS-817] fix for windows_task does not parse backslashes in the command property
Signed-off-by: vasu1105 <vasundhara.jagdale@msystechnologies.com>
-rw-r--r--lib/chef/provider/windows_task.rb1
-rw-r--r--spec/functional/resource/windows_task_spec.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb
index c9109d6996..0bb28c66c6 100644
--- a/lib/chef/provider/windows_task.rb
+++ b/lib/chef/provider/windows_task.rb
@@ -231,6 +231,7 @@ class Chef
# seprated command arguments from :command property
def set_command_and_arguments
+ new_resource.command = new_resource.command.gsub(/\\/, '\&\&')
cmd, *args = Shellwords.split(new_resource.command)
new_resource.command = cmd
new_resource.command_arguments = args.join(" ")
diff --git a/spec/functional/resource/windows_task_spec.rb b/spec/functional/resource/windows_task_spec.rb
index d4a2bcc14e..65a396cf56 100644
--- a/spec/functional/resource/windows_task_spec.rb
+++ b/spec/functional/resource/windows_task_spec.rb
@@ -68,7 +68,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
current_resource = call_for_load_current_resource
expect(current_resource.exists).to eq(true)
expect(current_resource.task.application_name).to eq("chef-client")
- expect(current_resource.task.parameters).to eq("-W -L C:\\chef\\chef-ad-join.log")
+ expect(current_resource.task.parameters).to eq("-W -L C:\\\\chef\\\\chef-ad-join.log")
end
it "does not converge the resource if it is already converged" do