Skip to content

Commit 33e23bf

Browse files
committed
Fix hang on systems with interactive rm
Some systems configure `rm` to prompt when deleting a file as root user. On such systems, hostmanager hangs when updating the hosts file since commit 84d2f9e ("fix host file management to be windows and linux compatible"). Avoid this by adding the '-f' parameter to rm.
1 parent ede8b48 commit 33e23bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/vagrant-hostmanager/hosts_file/updater.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def update_guest(machine)
4545
if windir
4646
machine.communicate.sudo("mv -force /tmp/hosts.#{machine.name} #{realhostfile}")
4747
else
48-
machine.communicate.sudo("cat /tmp/hosts.#{machine.name} > #{realhostfile} && rm /tmp/hosts.#{machine.name}")
48+
machine.communicate.sudo("cat /tmp/hosts.#{machine.name} > #{realhostfile} && rm -f /tmp/hosts.#{machine.name}")
4949
end
5050
end
5151

0 commit comments

Comments
 (0)