Skip to content

Commit bb53e42

Browse files
committed
Retain tmp hosts file and fix a bug where powershell mv does not move folder contents, in that context it's moving a file.
1 parent 302337b commit bb53e42

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/vagrant-hostmanager/hosts_file/updater.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@ def update_guest(machine)
3636

3737
# upload modified file and remove temporary file
3838
machine.communicate.upload(file, '/tmp/hosts')
39-
machine.communicate.sudo("#{move_cmd} /tmp/hosts #{realhostfile}")
39+
if windir
40+
machine.communicate.sudo("#{move_cmd} /tmp/hosts/hosts.#{machine.name} #{realhostfile}")
41+
else
42+
machine.communicate.sudo("#{move_cmd} /tmp/hosts #{realhostfile}")
43+
end
4044
end
4145

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

4948
def update_host

0 commit comments

Comments
 (0)