Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion libraries/manipulator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ def new_content
entries = hostsfile_header
entries += unique_entries.map(&:to_line)
entries << ''
entries.join("\n")
line_ending = "\n"
line_ending = "\r\n" if node['platform_family'] == 'windows'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could combine this line (ex. line_ending = node['platform_family'] == 'windows' ? "\r\n" : "\n") so that we don't assign line_ending twice, in the uncommon case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me, ruby isn't my first language :)

entries.join(line_ending)
end

# The current sha of the system hostsfile.
Expand Down