fix(cli): add detached: !isWindows() to dashboard spawn for correct process cleanup

Without detached:true on Unix, killProcessTree(pid) calls process.kill(-pid)
which targets a process group the child never owns — ESRCH causes fallback to
direct kill, leaving grandchild processes alive. Matches the pattern already
used in start.ts lines 782 and 795.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Priyanshu Choudhary 2026-04-08 21:28:38 +05:30
parent 14a844829e
commit 6031f2e962
1 changed files with 2 additions and 1 deletions

View File

@ -2,7 +2,7 @@ import { spawn } from "node:child_process";
import { resolve } from "node:path";
import chalk from "chalk";
import type { Command } from "commander";
import { killProcessTree, loadConfig } from "@composio/ao-core";
import { isWindows, killProcessTree, loadConfig } from "@composio/ao-core";
import { findWebDir, buildDashboardEnv, waitForPortAndOpen } from "../lib/web-dir.js";
import {
findRunningDashboardPid,
@ -67,6 +67,7 @@ export function registerDashboard(program: Command): void {
const child = spawn("node", [startScript], {
cwd: webDir,
stdio: ["inherit", "inherit", "pipe"],
detached: !isWindows(),
env,
});