GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — Make Measure-Object property test independent of the filesystem by rjmholt · Pull Request #15879 · PowerShell/PowerShell Conversation
Collaborator
PR SummaryFixes a recent CI failure where the expected and actual results of this test disagree because there's a directory in the PR ContextPR Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Rob Holt (rjmholt)
enabled auto-merge (squash)
Uh oh!
There was an error while loading. Please reload this page.
Rob Holt (rjmholt)
disabled auto-merge
Rob Holt (rjmholt)
marked this pull request as draft
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
I can reproduce: PS> $(Get-ChildItem C:\temp\ | Measure-Object -Property Length).Count Measure-Object: Cannot process argument because the value of argument "Property" is not valid. Change the value of the "Property" argument and run the operation again. 0 PS > Get-ChildItem C:\temp\ -Recurse Directory: C:\temp Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 12.05.2021 17:22 52293_original My current folder is not |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I see, this doesn't repro on macOS. Got a repro on my Windows machine. I think |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't understand the design: PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs Lines 820 to 827 in a4181ab
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It looks like the design is to only return that error which is effectively terminating if the result is 0 and the property doesn't match. So if you have a folder that ONLY has an empty folder, then this will fail, but if it has any files it should succeed (which still doesn't make sense to me why the test fails unless it's a race condition). Is there a repro where there are other items in the folder other than a single empty folder? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
It seems my bad. DirectoryInfo hasn't Length property. FileInfo has. The PR is correct. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Addressed the filesystem dependency issue
|
🎉 Handy links: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🎉 Handy links: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.