Skip to content

No-argument tab-completion fails with Get-Process on macOS, possibly due to process objects lacking a ProcessName property #7174

Closed

Description

Steps to reproduce

On macOS, try the following:

Get-Process  # < -- press <tab> here (whether once or multiple times makes no difference)

On Windows and Linux you get the names of all running processes, but on macOS nothing happens.

Expected behavior

A list (menu) of the names of all running processes.

Actual behavior

Nothing happens at all.

The problem goes away once you've typed at least prefix char. of the process name to match.

Presumed cause:

On macOS, many processes output by Get-Process lack a .Name aka .ProcessName value.

As an aside: Is that expected or a bug in itself?

It seems that these entries without a .Name value cause the problem when the list of completions is constructed:

Jason Shirk (@lzybkr) provided the following code to diagnose the problem, which simulates what happens when you tab-complete, while also surfacing exceptions:

$line = "Get-Process "  # Simulate `Get-Process <tab>`
TabExpansion2 $line $line.Length

The above, rather than outputting a [System.Management.Automation.CommandCompletion] object with all process names, reports the following error:

Exception calling "CompleteInput" with "3" argument(s): "Cannot process argument because the value of argument "listItemText" is null. Change the value of argument "listItemText"
...

Environment data

PowerShell Core v6.1.0-preview.3 on macOS 10.13.5

Activity

  1. changed the title [-]No-argument tab-completion fails with Get-Process on macOS, possibly due to process objects lacking a ProcessName entry[/-] [+]No-argument tab-completion fails with Get-Process on macOS, possibly due to process objects lacking a ProcessName property[/+] on Jun 25, 2018
  2. added
    WG-Engine
    on Jun 26, 2018
  3. SteveL-MSFT commented on Jun 26, 2018

    @SteveL-MSFT
    Member

    Michael Klement (@mklement0) thanks to your detailed bug report, I was able to find the root issue and should have a fix soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Resolution-FixedWG-Engine

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions