89db7505d6
`Read-Host` calls into `$Host.UI.Prompt()`. However, this method is also used when the host prompts for mandatory parameters that aren't provided. The method expects to be called when given a `FieldDescription` and if the input starts with `!` it enters `CommandPromptMode`. In this mode, you can type `!?` to request help, for example. However this mode is not something you can use via `Read-Host` (only if calling `$Host.UI.Prompt()` directly passing in a well constructed `FieldDescription`). When using `Read-Host -Prompt`, the cmdlet creates a `FieldDescription` where the name is the prompt and the rest of the properties are empty. The fix is that if `Label` is empty, we can assume it's being called from `Read-Host` rather than being called to prompt for a mandatory parameter and thus not enter `CommandPromptMode`. |
||
---|---|---|
.. | ||
CimCmdlets | ||
Microsoft.PowerShell.Core | ||
Microsoft.PowerShell.Diagnostics | ||
Microsoft.Powershell.Host | ||
Microsoft.PowerShell.LocalAccounts | ||
Microsoft.PowerShell.Management | ||
Microsoft.PowerShell.Security | ||
Microsoft.PowerShell.Utility | ||
Microsoft.WSMan.Management | ||
PackageManagement | ||
PowerShellGet | ||
PSDesiredStateConfiguration | ||
PSDiagnostics | ||
PSReadLine | ||
ThreadJob |