Skip to content

Commit

Permalink
Fix situation with hosts file line endings
Browse files Browse the repository at this point in the history
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."
  • Loading branch information
la-magra committed Mar 6, 2015
1 parent 176d70e commit ca57c23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/vagrant-hostmanager/hosts_file/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def update_file(file, resolving_machine = nil, include_id = true)
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

Expand Down

0 comments on commit ca57c23

Please sign in to comment.