summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2018-05-17 13:17:53 -0400
committerGitHub <noreply@github.com>2018-05-17 13:17:53 -0400
commitf5b5c9c156db41d5a0f323aad0763da2ceea38fb (patch)
tree0ffba51b6be9c1de226b30b1b30bf1ed2a17cc45
parent985488397c1b8d4c1cab0a6a6613f17665311211 (diff)
parenta6c3be3c9f19bfe242a99276a58e56d07e78e798 (diff)
downloadchef-f5b5c9c156db41d5a0f323aad0763da2ceea38fb.tar.gz
Merge pull request #7281 from MsysTechnologiesllc/vasundhara/Fix_for_windows_task_does_not_parse_backshlash_in_command_properly
[MSYS-817] fix for windows_task does not parse backslashes in the commad property
-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