Verify recorder identity once and retain original native process handles
This commit is contained in:
@@ -217,16 +217,16 @@ finally {
|
||||
if (!$recorder.process.HasExited -and !$recorder.process.WaitForExit(($recorder.seconds+30)*1000)) {
|
||||
$result.status='failed'; $result.recorderError='Recorder exceeded completion bound; own native process stopped before restoration'
|
||||
$ready=Get-Content -LiteralPath (Join-Path $EvidenceDir "$($recorder.name).wav.ready.json") -Raw | ConvertFrom-Json
|
||||
$native=Get-Process -Id $ready.recorderPid -ErrorAction SilentlyContinue
|
||||
if ($native) { $native.Kill(); $native.WaitForExit() }
|
||||
$native=$recorder.nativeProcess
|
||||
if ($native -and !$native.HasExited) { $native.Kill(); $native.WaitForExit() }
|
||||
$recorder.process.WaitForExit(10000) | Out-Null
|
||||
if (!$recorder.process.HasExited) { $recorder.process.Kill(); $recorder.process.WaitForExit() }
|
||||
}
|
||||
$readyPath=Join-Path $EvidenceDir "$($recorder.name).wav.ready.json"
|
||||
if (Test-Path -LiteralPath $readyPath) {
|
||||
$ready=Get-Content -LiteralPath $readyPath -Raw | ConvertFrom-Json
|
||||
$native=Get-Process -Id $ready.recorderPid -ErrorAction SilentlyContinue
|
||||
if ($native) { $native.WaitForExit() }
|
||||
$native=$recorder.nativeProcess
|
||||
if ($native -and !$native.HasExited -and !$native.WaitForExit(10000)) { throw 'Own native recorder did not terminate' }
|
||||
$commands.Add(@{command='recorder termination boundary';recorderPid=$ready.recorderPid;wrapperPid=$recorder.process.Id;nativeExited=$true;wrapperExited=$recorder.process.HasExited;utc=[DateTime]::UtcNow.ToString('o')})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user