Files
fusion/plugins/fusion-plugin-cursor-runtime/src/cli-spawn.ts
Fusion 3735e0565a feat(FN-3396): bundle Cursor CLI as a plugin provider with dashboard auth w
Merges FN-3396's full Cursor CLI provider integration (Steps 1–4): defines a CLI-backed provider contract, adds the `fusion-plugin-cursor-runtime` plugin package with process management and runtime probes, wires dashboard auth flows and UI (ProviderCard, onboarding modal, settings), and bundles the

Fusion-Task-Id: FN-3396
2026-05-07 04:17:52 -07:00

26 lines
932 B
TypeScript

import { spawn } from "node:child_process";
export async function runCursorCommand(binary: string, args: string[], timeoutMs: number): Promise<{ code: number | null; stdout: string; stderr: string }> {
return new Promise((resolve) => {
const child = spawn(binary, args, { stdio: ["ignore", "pipe", "pipe"] });
let stdout = "";
let stderr = "";
const timer = setTimeout(() => {
try { child.kill("SIGKILL"); } catch {
// best effort
}
resolve({ code: 124, stdout, stderr });
}, timeoutMs);
child.stdout?.on("data", (c: Buffer) => { stdout += c.toString("utf-8"); });
child.stderr?.on("data", (c: Buffer) => { stderr += c.toString("utf-8"); });
child.once("error", () => {
clearTimeout(timer);
resolve({ code: 127, stdout, stderr });
});
child.once("close", (code) => {
clearTimeout(timer);
resolve({ code, stdout, stderr });
});
});
}