Skip to content

Get-Command doesn't properly recognize System.Management.Automation.CommandInfo (its own output type) as pipeline input #11017

@mklement0

Description

@mklement0

#10851 reported that feeding Get-Command output to itself via the pipeline - useful if you want to force loading of all modules in the context of reflection, for instance - doesn't work as expected.

#10929 tried to fix that, but fell short.

Steps to reproduce

function foo {}; set-alias foo foo

(gcm -all foo | gcm).Count | Should -Be 2

(gcm -all foo | gcm).ComandType | Should -Be Alias, Function

Expected behavior

The tests should succeed.

Actual behavior

The tests fail:

Expected 2, but got 278                   #  *all* commands are returned
Expected @('Alias', 'Function'), but got $null

Environment data

PowerShell Core 7.0.0-preview.5, with PR #10929 applied

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions