We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dcbcd44 + 50b34b9 commit 5597482Copy full SHA for 5597482
lib/vagrant-hostmanager/hosts_file/updater.rb
@@ -56,7 +56,7 @@ class << self
56
copy_proc = Proc.new { windows_copy_file(file, hosts_location) }
57
else
58
hosts_location = '/etc/hosts'
59
- copy_proc = Proc.new { `sudo cp #{file} #{hosts_location}` }
+ copy_proc = Proc.new { `[ -w #{hosts_location} ] && cat #{file} > #{hosts_location} || sudo cp #{file} #{hosts_location}` }
60
end
61
62
FileUtils.cp(hosts_location, file)
0 commit comments