feat(gmail-watcher): register gog child with registry

This commit is contained in:
Trevin Chow 2026-01-29 12:32:03 -08:00 committed by Trevin Chow
parent 13d0644c01
commit db125c7d57
2 changed files with 7 additions and 0 deletions

View File

@ -8,6 +8,7 @@
import { type ChildProcess, spawn } from "node:child_process";
import { hasBinary } from "../agents/skills.js";
import type { MoltbotConfig } from "../config/config.js";
import { registerChild } from "../infra/child-registry.js";
import { createSubsystemLogger } from "../logging/subsystem.js";
import { runCommandWithTimeout } from "../process/exec.js";
import {
@ -73,6 +74,9 @@ function spawnGogServe(cfg: GmailHookRuntimeConfig): ChildProcess {
detached: false,
});
// Register with child registry (managedExternally: true because we have our own stop logic)
registerChild("gog-gmail-watcher", child, { managedExternally: true });
child.stdout?.on("data", (data: Buffer) => {
const line = data.toString().trim();
if (line) log.info(`[gog] ${line}`);

View File

@ -1,6 +1,7 @@
import { spawn } from "node:child_process";
import net from "node:net";
import { registerChild } from "./child-registry.js";
import { ensurePortAvailable } from "./ports.js";
export type SshParsedTarget = {
@ -145,6 +146,8 @@ export async function startSshPortForward(opts: {
const child = spawn("/usr/bin/ssh", args, {
stdio: ["ignore", "ignore", "pipe"],
});
// Register with child registry (managedExternally: true because tunnel has its own stop logic)
registerChild("ssh-tunnel", child, { managedExternally: true });
child.stderr?.setEncoding("utf8");
child.stderr?.on("data", (chunk) => {
const lines = String(chunk)