Files
openclaw/src/infra/node-shell.ts
2026-06-04 03:20:32 -04:00

14 lines
660 B
TypeScript

// Builds platform shell argv for Node-driven command execution.
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";
// Node shell command construction keeps platform shell flags centralized for
// system.run and related command execution paths.
/** Build argv for running a command through the platform default shell. */
export function buildNodeShellCommand(command: string, platform?: string | null) {
const normalized = normalizeLowercaseStringOrEmpty((platform ?? "").trim());
if (normalized.startsWith("win")) {
return ["cmd.exe", "/d", "/s", "/c", command];
}
return ["/bin/sh", "-lc", command];
}