Skip to content

Commit

Permalink
dont alter the path during the bundler cleanup on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Wrock <[email protected]>
  • Loading branch information
mwrock committed Dec 5, 2016
1 parent 0b02854 commit dfb8ccf
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions lib/kitchen/driver/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,22 @@ def run_command(cmd, options = {})
RUBYOPT _ORIGINAL_GEM_PATH].each do |var|
env[var] = nil
end
gem_home = ENV["GEM_HOME"]
if gem_home && (env["PATH"] || ENV["PATH"])
env["PATH"] ||= ENV["PATH"].dup if ENV["PATH"]
gem_bin = File.join(gem_home, "bin") + File::PATH_SEPARATOR
env["PATH"][gem_bin] = "" if env["PATH"].include?(gem_bin)

# Altering the path seems to break vagrant. When the :environment
# is passed to a windows process with a PATH, Vagrant's batch installer
# (https://github.com/mitchellh/vagrant-installers/blob/master/substrate
# /modules/vagrant_installer/templates/windows_vagrant.bat.erb)
# does not efectively prepend the vagrant ruby path in a persistent
# manner which causes vagrant to use the same ruby as test-kitchen and
# then the environment is essentially corrupted leading to many errors
# and dispair
unless windows_host?
gem_home = ENV["GEM_HOME"]
if gem_home && (env["PATH"] || ENV["PATH"])
env["PATH"] ||= ENV["PATH"].dup if ENV["PATH"]
gem_bin = File.join(gem_home, "bin") + File::PATH_SEPARATOR
env["PATH"][gem_bin] = "" if env["PATH"].include?(gem_bin)
end
end

super(cmd, merged)
Expand Down

0 comments on commit dfb8ccf

Please sign in to comment.