launch error display

This commit is contained in:
Nathan
2025-12-17 17:18:27 -07:00
parent 84a518a9c9
commit 188d74c072
7 changed files with 21351 additions and 19 deletions

View File

@@ -224,8 +224,24 @@ function Get-PendingCommands {
# endregion
try {
# Check if metadata already exists with a ControllerPid (set by ensureScript)
$existingControllerPid = $null
if (Test-Path $metaPath) {
try {
$existing = Get-Content $metaPath -Raw | ConvertFrom-Json
if ($existing.ControllerPid) {
$existingControllerPid = $existing.ControllerPid
}
} catch {
# Ignore parse errors
}
}
# Use existing ControllerPid if available, otherwise use current PID
$controllerPidToUse = if ($existingControllerPid) { $existingControllerPid } else { $PID }
# record initial state before launching worker
Write-Metadata -Status 'initializing' -WorkerPid $null -ControllerPid $PID -Restarts 0
Write-Metadata -Status 'initializing' -WorkerPid $null -ControllerPid $controllerPidToUse -Restarts 0
$resolvedPayloadBase64 = Resolve-PayloadBase64
$PayloadBase64 = $resolvedPayloadBase64