fix(lab): bound T-014 process cleanup [T-014]
Harness governance / validate (push) Has been cancelled
Harness governance / validate (push) Has been cancelled
This commit is contained in:
@@ -125,6 +125,20 @@ function Stop-ManagedProcess($Managed) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Stop-AllManagedProcesses($Items) {
|
||||||
|
$processes = @($Items | Where-Object { $null -ne $_ -and $null -ne $_.Process })
|
||||||
|
foreach ($item in $processes) {
|
||||||
|
if (-not $item.Process.HasExited) {
|
||||||
|
$item.Process.Kill()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($item in $processes) {
|
||||||
|
if (-not $item.Process.HasExited) {
|
||||||
|
$item.Process.WaitForExit(10000) | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Assert-Alive($Managed) {
|
function Assert-Alive($Managed) {
|
||||||
if ($null -eq $Managed -or $Managed.Process.HasExited) {
|
if ($null -eq $Managed -or $Managed.Process.HasExited) {
|
||||||
$code = if ($null -eq $Managed) { 'not-started' } else { $Managed.Process.ExitCode }
|
$code = if ($null -eq $Managed) { 'not-started' } else { $Managed.Process.ExitCode }
|
||||||
@@ -879,9 +893,7 @@ catch {
|
|||||||
$failure = "T-014 stage '$stage' failed: $($_.Exception.Message)"
|
$failure = "T-014 stage '$stage' failed: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
foreach ($item in @($managed)) {
|
Stop-AllManagedProcesses @($managed)
|
||||||
Stop-ManagedProcess $item
|
|
||||||
}
|
|
||||||
if ($postgresStarted) {
|
if ($postgresStarted) {
|
||||||
& $script:pgCtl '-D' $pgData '-m' 'fast' '-w' 'stop' | Out-Null
|
& $script:pgCtl '-D' $pgData '-m' 'fast' '-w' 'stop' | Out-Null
|
||||||
$postgresStopped = $LASTEXITCODE -eq 0
|
$postgresStopped = $LASTEXITCODE -eq 0
|
||||||
|
|||||||
Reference in New Issue
Block a user