Log daemon supervisor exit reasons

This commit is contained in:
Mohamed Boudra
2026-06-08 23:02:36 +07:00
parent 9d9f6905c6
commit b0954d1616
2 changed files with 65 additions and 11 deletions

View File

@@ -191,11 +191,23 @@ export function runSupervisor(options: SupervisorOptions): void {
const heartbeat = setInterval(() => {
const message: SupervisorHeartbeatMessage = { type: "paseo:supervisor-heartbeat" };
if (currentChild.connected) {
currentChild.send?.(message, () => undefined);
currentChild.send?.(message, (error) => {
if (error) {
writeLifecycleLog("Worker heartbeat IPC send failed", {
error: error instanceof Error ? error.message : String(error),
});
}
});
} else {
writeLifecycleLog("Worker heartbeat skipped because IPC channel is disconnected");
}
}, 1000);
heartbeat.unref();
child.on("disconnect", () => {
writeLifecycleLog("Worker IPC channel disconnected");
});
child.stdout?.on("data", (chunk: Buffer) => {
process.stdout.write(chunk);
writeDurableChunk(chunk);