mirror of https://github.com/openclaw/openclaw.git
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.
This commit is contained in:
parent
a05a251be0
commit
ca778b3f3c
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue