Skip to content

Commit

Permalink
[COOK-3482] Add git to the PATH for the current chef-client run on Wi…
Browse files Browse the repository at this point in the history
…ndows

The windows_path resource doesn't change the current process' environment variables. Therefore, git won't actually be on the PATH until the next chef-client run. By directly modifying ENV, we allow git to be on the PATH during this chef-client run.

Signed-off-by: Seth Vargo <[email protected]>
  • Loading branch information
Veered authored and sethvargo committed Oct 1, 2013
1 parent 7de9552 commit 5b60899
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion recipes/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
# Git is installed to Program Files (x86) on 64-bit machines and
# 'Program Files' on 32-bit machines
PROGRAM_FILES = ENV['ProgramFiles(x86)'] || ENV['ProgramFiles']
GIT_PATH = ";#{ PROGRAM_FILES }\\Git\\Cmd"

windows_path "#{ PROGRAM_FILES }\\Git\\Cmd" do
# COOK-3482 - windows_path resource doesn't change the current process
# environment variables. Therefore, git won't actually be on the PATH
# until the next chef-client run
ENV['PATH'] += ";#{GIT_PATH}"
windows_path GIT_PATH do
action :add
end

0 comments on commit 5b60899

Please sign in to comment.