Skip to content

Conversation

@TylerLeonhardt
Copy link
Member

fixes PowerShell/vscode-powershell#1790

Changes the default to string.Empty to be constant with ConsoleHost.

This also means that Read-Host and Read-Host -Prompt have the same behavior when the user just hits <ENTER> on a prompt.

keyValuePair.Value != null
? PSObject.AsPSObject(keyValuePair.Value)
: null);
: string.Empty);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the comment is wrong "Convert all values to PSObjects" but if not, maybe this should be:

psObjectDict.Add(
    keyValuePair.Key,
    PSObject.AsPSObject(keyValuePair.Value ?? string.Empty));

Copy link
Member Author

Choose a reason for hiding this comment

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

yours is nicer 😄 went with that.

@TylerLeonhardt TylerLeonhardt merged commit d7c2893 into PowerShell:master Feb 3, 2020
@TylerLeonhardt TylerLeonhardt deleted the consistent-read-host-behavior branch February 3, 2020 17:26
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.

PSIC Read-Host returns $null when input is left empty

4 participants