mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-27 21:33:35 +00:00
14 lines
660 B
TypeScript
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];
|
|
}
|