UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

28 lines (27 loc) 933 B
import { n as signalProcessTree } from "./kill-tree-CR2oLt9D.js"; //#region src/process/child-process-tree.ts function shouldDetachChildForProcessTree() { return process.platform !== "win32"; } function isChildProcessTreeAlive(child) { if (typeof child.pid !== "number" || child.pid <= 0) return false; const target = shouldDetachChildForProcessTree() ? -child.pid : child.pid; try { process.kill(target, 0); return true; } catch { return false; } } function signalChildProcessTree(child, signal) { if (typeof child.pid === "number" && child.pid > 0) { signalProcessTree(child.pid, signal, { detached: shouldDetachChildForProcessTree() }); return; } child.kill(signal); } function forceKillChildProcessTree(child) { signalChildProcessTree(child, "SIGKILL"); } //#endregion export { signalChildProcessTree as i, isChildProcessTreeAlive as n, shouldDetachChildForProcessTree as r, forceKillChildProcessTree as t };