From ca57c2394143593ddbdfe014fbe4c8ac4b5405a4 Mon Sep 17 00:00:00 2001 From: la-magra Date: Thu, 5 Mar 2015 18:41:27 -0600 Subject: [PATCH] Fix situation with hosts file line endings I ran into a situation in which the the hosts file in the guest (ubuntu 14.04) had CRLF line endings when vagranted from a Windows server 2012 R2, with Vagrant 1.7.2 with hostmanager 1.5.0 . The vagrant commands where run from a cygwin shell. As per Ruby documentation, replacing open mode to binary "Suppresses EOL <-> CRLF conversion on Windows." --- 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 3b24260..07ad451 100644 --- a/lib/vagrant-hostmanager/hosts_file/updater.rb +++ b/lib/vagrant-hostmanager/hosts_file/updater.rb @@ -75,7 +75,7 @@ module VagrantPlugins file = Pathname.new(file) old_file_content = file.read new_file_content = update_content(old_file_content, resolving_machine, include_id) - file.open('w') { |io| io.write(new_file_content) } + file.open('wb') { |io| io.write(new_file_content) } old_file_content != new_file_content end