Files
openclaw/scripts/lib/managed-child-process.d.mts
xingzhou b5c0878777 fix(build): bound bundled plugin asset generators (#111366)
Fail build and copy generators with ETIMEDOUT after 600000ms and terminate the complete managed process tree. Keep the timeout policy in the bundled-assets caller while preserving the shared helper for distinct callers such as #111349.

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-30 04:56:21 +08:00

146 lines
3.3 KiB
TypeScript

/**
* Return conventional shell exit code for a signal.
*
* @param {NodeJS.Signals} signal
* @returns {number}
*/
export function signalExitCode(signal: NodeJS.Signals): number;
/**
* @param {import("node:child_process").ChildProcess} child
* @param {NodeJS.Signals} [signal]
* @param {{ platform?: NodeJS.Platform; runTaskkill?: typeof spawnSync }} [options]
*/
export function terminateManagedChild(
child: Pick<import("node:child_process").ChildProcess, "kill" | "pid">,
signal?: NodeJS.Signals,
{
platform,
runTaskkill,
}?: {
platform?: NodeJS.Platform;
runTaskkill?: (command: string, args?: string[]) => { error?: Error; status: number | null };
},
): void;
/**
* Run a child command while forwarding termination signals to the managed process group.
*
* @param {{
* bin: string;
* args?: string[];
* cwd?: string;
* env?: NodeJS.ProcessEnv;
* stdio?: import("node:child_process").StdioOptions;
* shell?: boolean;
* windowsVerbatimArguments?: boolean;
* platform?: NodeJS.Platform;
* comSpec?: string;
* timeoutMs?: number;
* onReady?: (child: import("node:child_process").ChildProcess) => void;
* }} options
* @returns {Promise<number>}
*/
export function runManagedCommand({
bin,
args,
cwd,
env,
stdio,
platform,
shell,
windowsVerbatimArguments,
comSpec,
timeoutMs,
onReady,
}: {
bin: string;
args?: string[];
cwd?: string;
env?: NodeJS.ProcessEnv;
stdio?: import("node:child_process").StdioOptions;
shell?: boolean;
windowsVerbatimArguments?: boolean;
platform?: NodeJS.Platform;
comSpec?: string;
timeoutMs?: number;
onReady?: (child: import("node:child_process").ChildProcess) => void;
}): Promise<number>;
/**
* @param {{
* bin: string;
* args?: string[];
* cwd?: string;
* env?: NodeJS.ProcessEnv;
* stdio?: import("node:child_process").StdioOptions;
* shell?: boolean;
* windowsVerbatimArguments?: boolean;
* platform?: NodeJS.Platform;
* comSpec?: string;
* }} options
*/
export function createManagedCommandSpawnSpec({
bin,
args,
cwd,
env,
stdio,
platform,
shell,
windowsVerbatimArguments,
comSpec,
}: {
bin: string;
args?: string[];
cwd?: string;
env?: NodeJS.ProcessEnv;
stdio?: import("node:child_process").StdioOptions;
shell?: boolean;
windowsVerbatimArguments?: boolean;
platform?: NodeJS.Platform;
comSpec?: string;
}): {
args: string[];
command: string;
options: {
cwd: string | undefined;
env: import("node:child_process").SpawnOptions["env"];
stdio: import("node:child_process").StdioOptions;
shell: boolean;
detached: boolean;
windowsVerbatimArguments: boolean | undefined;
};
};
/**
* @param {{
* bin: string;
* args?: string[];
* env?: NodeJS.ProcessEnv;
* shell?: boolean;
* windowsVerbatimArguments?: boolean;
* platform?: NodeJS.Platform;
* comSpec?: string;
* }} options
*/
export function createManagedCommandInvocation({
bin,
args,
env,
platform,
shell,
windowsVerbatimArguments,
comSpec,
}: {
bin: string;
args?: string[];
env?: NodeJS.ProcessEnv;
shell?: boolean;
windowsVerbatimArguments?: boolean;
platform?: NodeJS.Platform;
comSpec?: string;
}): {
args: string[];
command: string;
shell: boolean;
windowsVerbatimArguments: boolean | undefined;
};
import { spawnSync } from "node:child_process";