Skip to content

Commit

Permalink
Update HostsUpdater.rb
Browse files Browse the repository at this point in the history
 agiledivider#195 No entries written to C:/Windows/system32/drivers/etc/hosts
  • Loading branch information
scm6079 authored Aug 7, 2023
1 parent c5cd30a commit 62fccfa
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions lib/vagrant-hostsupdater/HostsUpdater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,6 @@ def addToHosts(entries)
@ui.error "[vagrant-hostsupdater] Failed to add hosts, could not use sudo"
adviseOnSudo
end
elsif Vagrant::Util::Platform.windows?
require 'tmpdir'
uuid = @machine.id || @machine.config.hostsupdater.id
tmpPath = File.join(Dir.tmpdir, 'hosts-' + uuid.to_s + '.cmd')
File.open(tmpPath, "w") do |tmpFile|
entries.each { |line| tmpFile.puts(">>\"#{@@hosts_path}\" echo #{line}") }
end
sudo(tmpPath)
File.delete(tmpPath)
else
content = "\n" + content + "\n"
hostsFile = File.open(@@hosts_path, "a")
Expand Down

0 comments on commit 62fccfa

Please sign in to comment.