-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Get-Command doesn't recognize System.Management.Automation.CommandInfo (its own output type) as pipeline input #10851
Copy link
Copy link
Closed
Labels
Committee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module
Description
Feeding Get-Command output to itself via the pipeline - useful if you want to force loading of all modules in the context of reflection - doesn't work as expected.
It looks like a new parameter set with a System.Management.Automation.CommandInfo-typed parameter would have to be introduced to support that.
Steps to reproduce
# OK
('Add-Content', 'Get-Content' | Get-Command).Name | Should -Be 'Add-Content', 'Get-Content'
# Fails
(Get-Command 'Add-Content', 'Get-Content' | Get-Command).Name | Should -Be 'Add-Content', 'Get-Content'Expected behavior
Both tests should succeed.
Actual behavior
The 2nd test fails, because the only CommandInfo object output is the one for Add-Content
Expected @('Add-Content', 'Get-Content'), but got 'Add-Content'
Environment data
PowerShell Core 7.0.0-preview.4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Committee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module