The command prefix should also be in the error color for NormalView (#18555)

This commit is contained in:
Steve Lee
2022-11-15 17:54:23 -08:00
committed by GitHub
parent b3a9ae371c
commit 65b353d9cf
@@ -1000,8 +1000,12 @@ namespace System.Management.Automation.Runspaces
if (@('NativeCommandErrorMessage','NativeCommandError') -notcontains $_.FullyQualifiedErrorId -and @('CategoryView','ConciseView','DetailedView') -notcontains $ErrorView)
{
$myinv = $_.InvocationInfo
if ($myinv -and $myinv.MyCommand)
{
$errorColor = ''
if ($Host.UI.SupportsVirtualTerminal) {
$errorColor = $PSStyle.Formatting.Error
}
$commandPrefix = if ($myinv -and $myinv.MyCommand) {
switch -regex ( $myinv.MyCommand.CommandType )
{
([System.Management.Automation.CommandTypes]::ExternalScript)
@@ -1046,6 +1050,11 @@ namespace System.Management.Automation.Runspaces
$myinv.InvocationName + ' : '
}
}
if ($commandPrefix)
{
$errorColor + $commandPrefix
}
")
.AddScriptBlockExpressionBinding(@"
Set-StrictMode -Off