mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix command runtime so StopUpstreamCommandsException doesn't get populated in -ErrorVariable (#10840)
This commit is contained in:
@@ -2381,7 +2381,8 @@ namespace System.Management.Automation
|
||||
// 913088-2005/06/06
|
||||
// PipelineStoppedException should not get added to $Error
|
||||
// 2008/06/25 - narrieta: ExistNestedPromptException should not be added to $error either
|
||||
if (!(e is HaltCommandException) && !(e is PipelineStoppedException) && !(e is ExitNestedPromptException))
|
||||
// 2019/10/18 - StopUpstreamCommandsException should not be added either
|
||||
if (!(e is HaltCommandException) && !(e is PipelineStoppedException) && !(e is ExitNestedPromptException) && !(e is StopUpstreamCommandsException))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -113,7 +113,12 @@ Describe "Select-Object" -Tags "CI" {
|
||||
$result[0].Size | Should -Be ($orig1 + 1)
|
||||
$dirObject[0].Size | Should -Be ($orig1 + 1)
|
||||
$dirObject[$TestLength].Size | Should -Be ($orig2 + 1)
|
||||
}
|
||||
}
|
||||
|
||||
It "Should not leak 'StopUpstreamCommandsException' internal exception for stopping upstream" {
|
||||
1,2 | Select-Object -First 1 -ErrorVariable err
|
||||
$err | Should -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Select-Object DRT basic functionality" -Tags "CI" {
|
||||
|
||||
Reference in New Issue
Block a user