-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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:
@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.LengthThe 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