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) {
|
||||
if ($null -eq $Managed -or $Managed.Process.HasExited) {
|
||||
$code = if ($null -eq $Managed) { 'not-started' } else { $Managed.Process.ExitCode }
|
||||
@@ -879,9 +893,7 @@ catch {
|
||||
$failure = "T-014 stage '$stage' failed: $($_.Exception.Message)"
|
||||
}
|
||||
finally {
|
||||
foreach ($item in @($managed)) {
|
||||
Stop-ManagedProcess $item
|
||||
}
|
||||
Stop-AllManagedProcesses @($managed)
|
||||
if ($postgresStarted) {
|
||||
& $script:pgCtl '-D' $pgData '-m' 'fast' '-w' 'stop' | Out-Null
|
||||
$postgresStopped = $LASTEXITCODE -eq 0
|
||||
|
||||
Reference in New Issue
Block a user