From 33e23bffb9d3ec697adef4b880d979f0c45e534a Mon Sep 17 00:00:00 2001 From: Simon Baatz Date: Tue, 17 Apr 2018 10:24:20 +0200 Subject: [PATCH] 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 84d2f9e4be2 ("fix host file management to be windows and linux compatible"). Avoid this by adding the '-f' parameter to rm. --- lib/vagrant-hostmanager/hosts_file/updater.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-hostmanager/hosts_file/updater.rb b/lib/vagrant-hostmanager/hosts_file/updater.rb index 97f827f..2d8affb 100644 --- a/lib/vagrant-hostmanager/hosts_file/updater.rb +++ b/lib/vagrant-hostmanager/hosts_file/updater.rb @@ -45,7 +45,7 @@ module VagrantPlugins if windir machine.communicate.sudo("mv -force /tmp/hosts.#{machine.name} #{realhostfile}") else - machine.communicate.sudo("cat /tmp/hosts.#{machine.name} > #{realhostfile} && rm /tmp/hosts.#{machine.name}") + machine.communicate.sudo("cat /tmp/hosts.#{machine.name} > #{realhostfile} && rm -f /tmp/hosts.#{machine.name}") end end