Updates
This commit is contained in:
+9
-1
@@ -3931,13 +3931,21 @@ async function bareAgentDispatchTool(o) {
|
||||
async function captureExec(line, timeoutMs, captureOpts) {
|
||||
const outPath = paths.cmdOut
|
||||
const captureExit = Boolean(captureOpts && captureOpts.captureExit)
|
||||
const trimmed = String(line || '').trim()
|
||||
const compoundShell =
|
||||
/\n/.test(trimmed) ||
|
||||
/(^|[;\s])(for|if|while|until|case|function)\b/.test(trimmed) ||
|
||||
/\b(do|done|then|else|fi|esac)\b/.test(trimmed) ||
|
||||
/&&|\|\||\(\(|\{|\}/.test(trimmed)
|
||||
/**
|
||||
* Do not wrap with `{ cmd ; }` — Bare OS `splitTokensBySemicolon` splits on every `;`
|
||||
* at depth 0 and does not treat `{ … }` as a compound, so `{` became argv[0]
|
||||
* (`unknown command: {`). Redirect only; read exit from env after `execLine`.
|
||||
*/
|
||||
const wrapped =
|
||||
line +
|
||||
(compoundShell
|
||||
? 'sh -c ' + bareAgentShellQuote(trimmed)
|
||||
: line) +
|
||||
' > ' +
|
||||
bareAgentShellQuote(outPath) +
|
||||
' 2>&1'
|
||||
|
||||
Reference in New Issue
Block a user