test: simplify bash tools command splitting · openclaw/openclaw@ff4d554
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -106,11 +106,16 @@ vi.mock("../process/supervisor/index.js", () => {
|
106 | 106 | const immediate = () => new Promise<void>((resolve) => setImmediate(resolve)); |
107 | 107 | const readEnvPath = (env?: NodeJS.ProcessEnv) => env?.PATH ?? env?.Path ?? ""; |
108 | 108 | const extractCommand = (input: SpawnInput) => input.ptyCommand ?? input.argv?.at(-1) ?? ""; |
109 | | -const splitCommands = (command: string) => |
110 | | -command |
111 | | -.split(";") |
112 | | -.map((part) => part.trim()) |
113 | | -.filter(Boolean); |
| 109 | +const splitCommands = (command: string) => { |
| 110 | +const commands: string[] = []; |
| 111 | +for (const part of command.split(";")) { |
| 112 | +const trimmed = part.trim(); |
| 113 | +if (trimmed.length > 0) { |
| 114 | +commands.push(trimmed); |
| 115 | +} |
| 116 | +} |
| 117 | +return commands; |
| 118 | +}; |
114 | 119 | const stdoutForSegment = (segment: string, env?: NodeJS.ProcessEnv) => { |
115 | 120 | if (segment === "echo $PATH" || segment === "Write-Output $env:PATH") { |
116 | 121 | return `${readEnvPath(env)}\n`; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。