Skip to content

Commit

Permalink
Retain tmp hosts file and fix a bug where powershell mv does not move…
Browse files Browse the repository at this point in the history
… folder contents, in that context it's moving a file.
  • Loading branch information
seth-reeser committed Aug 6, 2015
1 parent 302337b commit bb53e42
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/vagrant-hostmanager/hosts_file/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ def update_guest(machine)

# upload modified file and remove temporary file
machine.communicate.upload(file, '/tmp/hosts')
machine.communicate.sudo("#{move_cmd} /tmp/hosts #{realhostfile}")
if windir
machine.communicate.sudo("#{move_cmd} /tmp/hosts/hosts.#{machine.name} #{realhostfile}")
else
machine.communicate.sudo("#{move_cmd} /tmp/hosts #{realhostfile}")
end
end

# i have no idea if this is a windows competibility issue or not, but sometimes it dosen't work on my machine
begin
FileUtils.rm(file)
rescue Exception => e
end
end

def update_host
Expand Down

0 comments on commit bb53e42

Please sign in to comment.