Skip to content

Commit

Permalink
Merge pull request #139 from markus-altran/master
Browse files Browse the repository at this point in the history
Remove empty lines at end of hosts file in removeFromHosts() method
  • Loading branch information
cgsmith authored Jul 13, 2017
2 parents 28df5a4 + 6ec2b22 commit 0752638
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/vagrant-hostsupdater/HostsUpdater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def addToHosts(entries)
adviseOnSudo
end
else
content = "\n" + content
content = "\n" + content + "\n"
hostsFile = File.open(@@hosts_path, "a")
hostsFile.write(content)
hostsFile.close()
Expand All @@ -127,6 +127,7 @@ def removeFromHosts(options = {})
File.open(@@hosts_path).each do |line|
hosts << line unless line.include?(hashedId)
end
hosts.strip!
hostsFile = File.open(@@hosts_path, "w")
hostsFile.write(hosts)
hostsFile.close()
Expand Down

0 comments on commit 0752638

Please sign in to comment.