added support for CRLF on windows to avoid max aliases per line issue#80
Open
dwkerwin wants to merge 2 commits into
Open
added support for CRLF on windows to avoid max aliases per line issue#80dwkerwin wants to merge 2 commits into
dwkerwin wants to merge 2 commits into
Conversation
Author
|
The first commit didn't completely solve the problem. Line terminations were right but it was still flattening the hosts to a single line. In the use case where you have multiple (> 10) hostnames which you want to all point to a single IP (typically 127.0.0.1), this exceeds the Windows limit of 9 per line. This change prevents this flattening for Windows while continuing to be idempotent, preventing duplicate entries by hostname rather than IP address. |
Author
|
It looks like the Travis CI errors are unrelated to my changes. Please let me know if this is not the case or how I could help. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've been using this for a while, and even though on Windows when you view the hosts file everything appears to be on one line, it has been working. I recently noticed that if you have a lot of host aliases on the same machine the ones at the end aren't honored, and then discovered that there is a limit on Windows of 9 aliases per line. So this small fix uses the environment specific newline terminator, so "\r\n" for Windows and "\n" for all other environments.