fix(cli): improve handling of Windows CRLF line endings #25
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.
Fixes a regex that was incorrectly breaking up
'\r\n'
/CRLF/␍␊ line-breaks (commonly used in Windows OSes) to just plain'\r'
. And it seems like the YAML library we're using: https://www.npmjs.com/package/yaml seems to not register just\r
as a line-break (although the YAML Spec v1.2.2 § 5.4 Line Break Characters does seem to say that either\r
,'\n'
or'\r\n'
can be used as a line break).On Windows, files are normally checked-out with
git config core.autocrlf true
, which will replace'\n'
/LF/␊ chars with'\r\n'
/CRLF/␍␊ chars. We should also handle this in our unit tests, otherwise tests will fail on Windows.