From aaa4ace350017d78bf74ebad157f5927ea6bbc7d Mon Sep 17 00:00:00 2001 From: Arenoros Date: Wed, 1 Dec 2021 08:50:37 +0300 Subject: [PATCH] [fix] #195 No entries written to C:/Windows/system32/drivers/etc/hosts --- lib/vagrant-hostsupdater/HostsUpdater.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/vagrant-hostsupdater/HostsUpdater.rb b/lib/vagrant-hostsupdater/HostsUpdater.rb index 85f76cf..c3caa2e 100644 --- a/lib/vagrant-hostsupdater/HostsUpdater.rb +++ b/lib/vagrant-hostsupdater/HostsUpdater.rb @@ -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")