mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix ConciseView to not show the line information within the error messages (#11952)
This commit is contained in:
+2
-1
@@ -1100,7 +1100,8 @@ namespace System.Management.Automation.Runspaces
|
||||
$offsetInLine = 0
|
||||
}
|
||||
else {
|
||||
$positionMessage = $myinv.PositionMessage.Split($newline)
|
||||
# use newline char instead of $newline because that is what is in the message
|
||||
$positionMessage = $myinv.PositionMessage.Split(""`n"")
|
||||
$line = $positionMessage[1].Substring(1) # skip the '+' at the start
|
||||
$highlightLine = $positionMessage[$positionMessage.Count - 1].Substring(1)
|
||||
$offsetLength = $highlightLine.Trim().Length
|
||||
|
||||
@@ -99,6 +99,12 @@ Describe 'Tests for $ErrorView' -Tag CI {
|
||||
$e = { throw "$msg" } | Should -Throw $msg -PassThru | Out-String
|
||||
$e | Should -BeLike "*$msg*"
|
||||
}
|
||||
|
||||
It "Position message does not contain line information" {
|
||||
|
||||
$e = & "$PSHOME/pwsh" -noprofile -command "foreach abc" | Out-String
|
||||
$e | Should -Not -BeLike "*At line*"
|
||||
}
|
||||
}
|
||||
|
||||
Context 'NormalView tests' {
|
||||
|
||||
Reference in New Issue
Block a user