Skip to content

Fix tab expansion for Get-Process on macOS - #7176

Merged
Aditya Patwardhan (adityapatwardhan) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:get-process-completer
Jun 27, 2018
Merged

Fix tab expansion for Get-Process on macOS#7176
Aditya Patwardhan (adityapatwardhan) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:get-process-completer

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Jun 26, 2018

Copy link
Copy Markdown
Member

PR Summary

macOS has a number of nameless processes. When tab expansion gets called, the empty process names results in an exception which fails the entire completer. Fix is to skip processes with empty name so that the named processes still show up in the result list.

Fix #7174

PR Checklist


if (string.IsNullOrEmpty(listItemText))
{
continue;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we now silently skip empty strings should we document this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised a process might not have a name - is this patching over a problem elsewhere, like in .Net?

At any rate, a comment on why this is expected would be useful.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jason Shirk (@lzybkr) if I run PowerShell with sudo, the process names are there. So presumably these are system processes where some properties are protected. I'll add a comment.

@BrucePay Bruce Payette (BrucePay) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit 5f47fc0 into PowerShell:master Jun 27, 2018
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the get-process-completer branch October 26, 2018 21:35
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
* fix tab exapnsion for get-process on macOS

* add comment to address PR feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

5 participants