Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to string.empty #1174

Merged

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.

@@ -312,7 +312,7 @@ public void SendControlC()
keyValuePair.Key,
keyValuePair.Value != null
? PSObject.AsPSObject(keyValuePair.Value)
: null);
: string.Empty);
Copy link
Collaborator

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