-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix 'Get-Content -Delimiter' to not include the delimiter in the returned lines #3808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 'Get-Content -Delimiter' to not include the delimiter in the returned lines #3808
Conversation
|
@mklement0, |
iSazonov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mklement0 It seems you don't fix "tail".
/cc @jeffbi Could you please review?
|
@iSazonov Thanks for catching the |
|
I believe the problem is in platform difference of Newline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be converted to use the -TestCase parameter for It? That would make the test much more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write these tests (and the only modification I made was to resolve aliases to their full cmdlet names), but I can look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than change it here, I suggest we open a new issue to refactor these test cases to use -TestCase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed Issue #3945 to cover this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to skip on Linux or OSX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I can't speak to these tests, but perhaps BugId(BugDatabase.WindowsOutOfBandReleases, 906022) holds the key?
Separately, if you have any pointers as to why the PR doesn't work on Windows (have yet to dig into it), that would be helpful.
@iSazonov thinks that it may be the difference in newline sequences, though that's not immediately obvious to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately, I don't know if that bug database even exists anymore. that comment is basically worthless now.
|
@adityapatwardhan I don't see any more outstanding comments. Do you have any additional concerns? |
|
@mklement0 Please address the failing test: [-] should Get-Content with a variety of -Tail and -ReadCount values 68ms |
|
@mirichmo: I'll take a look soon. In the meantime, if you have a high-level pointer as to how the platform-specific newline sequence might come into play here (it works in the Unix world, but not on Windows), please let me know. |
|
@mklement0 Test failed for Also I see the code is not optimal and we should refactor this in another PR. |
|
Thanks for the tips, @iSazonov. |
65c0a5f to
906a276
Compare
|
Note that the only changes to Thanks to @iSazonov for pointing me to what I hope is the right fix, which turned out to be simple in the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we evaluate content.ToString() twice - maybe do this one before block.Add().
|
@mklement0 Could you please split functional and formatting changes to two commits? This will help us avoid error skipping. |
…lements returned (PowerShell#3706) - functional changes
…lements returned (PowerShell#3706) - formatting changes
906a276 to
c50f3f8
Compare
|
@iSazonov: I've made the changes and split them into 2 commits (functional vs. formatting) that replaced the earlier ones. I think the Travis CI failure is a transient one, unrelated to my changes (it got stuck while setting up the environment). Is there a way to re-initiate the test? |
|
@mklement0 I restarted that job for you |
|
@mklement0 Tip: You can "rename" last commit to restart CI jobs. |
|
Thanks, @iSazonov, but how do you rename a commit? Amend the commit message and push again? |
|
Thanks all! Since we got 2 approvals and @iSazonov's comments are also addressed, I will rebase and merge this PR soon (in about one hour). Please let me know if there are any concerns. |
|
@mklement0 Yes, you can amend or rebase+reword. |
Fix #3706