From ca778b3f3c2fc47e97862fdad2de45409cfcfda0 Mon Sep 17 00:00:00 2001 From: Stephen Schoettler Date: Sun, 22 Mar 2026 17:18:26 -0700 Subject: [PATCH] fix(browser): add ChildProcessWithoutNullStreams cast for @types/node compat The stdio tuple overload resolves differently across @types/node versions (v20 vs v24/v25). Cast the spawn() result to ChildProcessWithoutNullStreams to ensure proc.stderr?.on/off type-checks regardless of installed @types/node. --- src/browser/chrome.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/browser/chrome.ts b/src/browser/chrome.ts index d4fadc22efa..47aef9a8e3e 100644 --- a/src/browser/chrome.ts +++ b/src/browser/chrome.ts @@ -1,4 +1,4 @@ -import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process"; +import { type ChildProcess, type ChildProcessWithoutNullStreams, spawn } from "node:child_process"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; @@ -70,7 +70,7 @@ export type RunningChrome = { userDataDir: string; cdpPort: number; startedAt: number; - proc: ChildProcessWithoutNullStreams; + proc: ChildProcess; }; function resolveBrowserExecutable(resolved: ResolvedBrowserConfig): BrowserExecutable | null { @@ -323,14 +323,18 @@ export async function launchOpenClawChrome( profile, userDataDir, }); + // stdio tuple: discard stdout to prevent buffer saturation in constrained + // environments (e.g. Docker), while keeping stderr piped for diagnostics. + // Cast to ChildProcessWithoutNullStreams so callers can use .stderr safely; + // the tuple overload resolution varies across @types/node versions. return spawn(exe.path, args, { - stdio: ["ignore", "ignore", "ignore"], + stdio: ["ignore", "ignore", "pipe"], env: { ...process.env, // Reduce accidental sharing with the user's env. HOME: os.homedir(), }, - }); + }) as unknown as ChildProcessWithoutNullStreams; }; const startedAt = Date.now();