feat(gmail-watcher): register gog child with registry
This commit is contained in:
parent
13d0644c01
commit
db125c7d57
@ -8,6 +8,7 @@
|
|||||||
import { type ChildProcess, spawn } from "node:child_process";
|
import { type ChildProcess, spawn } from "node:child_process";
|
||||||
import { hasBinary } from "../agents/skills.js";
|
import { hasBinary } from "../agents/skills.js";
|
||||||
import type { MoltbotConfig } from "../config/config.js";
|
import type { MoltbotConfig } from "../config/config.js";
|
||||||
|
import { registerChild } from "../infra/child-registry.js";
|
||||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||||
import { runCommandWithTimeout } from "../process/exec.js";
|
import { runCommandWithTimeout } from "../process/exec.js";
|
||||||
import {
|
import {
|
||||||
@ -73,6 +74,9 @@ function spawnGogServe(cfg: GmailHookRuntimeConfig): ChildProcess {
|
|||||||
detached: false,
|
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) => {
|
child.stdout?.on("data", (data: Buffer) => {
|
||||||
const line = data.toString().trim();
|
const line = data.toString().trim();
|
||||||
if (line) log.info(`[gog] ${line}`);
|
if (line) log.info(`[gog] ${line}`);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { spawn } from "node:child_process";
|
import { spawn } from "node:child_process";
|
||||||
import net from "node:net";
|
import net from "node:net";
|
||||||
|
|
||||||
|
import { registerChild } from "./child-registry.js";
|
||||||
import { ensurePortAvailable } from "./ports.js";
|
import { ensurePortAvailable } from "./ports.js";
|
||||||
|
|
||||||
export type SshParsedTarget = {
|
export type SshParsedTarget = {
|
||||||
@ -145,6 +146,8 @@ export async function startSshPortForward(opts: {
|
|||||||
const child = spawn("/usr/bin/ssh", args, {
|
const child = spawn("/usr/bin/ssh", args, {
|
||||||
stdio: ["ignore", "ignore", "pipe"],
|
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?.setEncoding("utf8");
|
||||||
child.stderr?.on("data", (chunk) => {
|
child.stderr?.on("data", (chunk) => {
|
||||||
const lines = String(chunk)
|
const lines = String(chunk)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user