mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-14 11:46:07 +00:00
* refactor(process): centralize bounded command execution * refactor(process): migrate core one-shot commands * refactor(plugins): migrate one-shot commands * fix(process): await Windows tree termination * chore(plugin-sdk): refresh process runtime surface * refactor(process): migrate remaining bounded commands * refactor(process): normalize command result handling * refactor(process): split execution responsibilities * chore(plugin-sdk): refresh API baseline * chore(process): remove release-owned changelog entry * fix(process): narrow binary command input checks * fix(process): cap sandbox command output * fix(qa-lab): preserve exact node probe env * chore(ci): refresh dead export baseline * fix(process): preserve force-kill command deadlines * fix(process): avoid post-exit timeout reclassification * test(process): update scp staging wrapper mock * test(process): update remaining wrapper mocks * refactor(qa-lab): preserve Execa tar execution
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
// Runtime helpers for bounded subprocess log tails and service runtime lookups.
|
|
import { runCommandWithTimeout } from "../process/exec.js";
|
|
|
|
export { buildGatewayConnectionDetails } from "../gateway/call.js";
|
|
export { resolveGatewaySystemdServiceName } from "../daemon/constants.js";
|
|
export { readSystemdServiceRuntime } from "../daemon/systemd.js";
|
|
|
|
type ExecFileTailResult = { stdout: string; stderr: string; code: number; truncated: boolean };
|
|
|
|
const STDERR_MAX_BYTES = 64 * 1024;
|
|
|
|
export async function execFileUtf8Tail(
|
|
command: string,
|
|
args: string[],
|
|
options: { env?: NodeJS.ProcessEnv; maxBytes: number },
|
|
): Promise<ExecFileTailResult> {
|
|
try {
|
|
const result = await runCommandWithTimeout([command, ...args], {
|
|
baseEnv: options.env,
|
|
maxOutputBytes: { stdout: options.maxBytes, stderr: STDERR_MAX_BYTES },
|
|
});
|
|
return {
|
|
stdout: result.stdout,
|
|
stderr: result.stderr,
|
|
code: result.code ?? 1,
|
|
truncated: Boolean(result.stdoutTruncatedBytes),
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
stdout: "",
|
|
stderr: error instanceof Error ? error.message : String(error),
|
|
code: 1,
|
|
truncated: false,
|
|
};
|
|
}
|
|
}
|