fix(cli): change sh to bash in dockerCoreFetchCommand/dockerCoreJson
Both functions use 'set -euo pipefail' in the script passed to 'docker exec ... sh -lc', but /bin/sh on Debian (dash) does not support -o pipefail, causing all microservice proxy and e2e API calls to fail with 'sh: 1: set: Illegal option -o pipefail'. Fix: use bash instead of sh, since bash is available in the container.
This commit is contained in:
+1
-1
@@ -1839,7 +1839,7 @@ function dockerCoreJson(path: string, init?: { method?: string; body?: unknown }
|
||||
"export url method body",
|
||||
"bun -e 'const url=process.env.url; const method=process.env.method; const body=process.env.body; fetch(url,{method,body:body?body:undefined,headers:body?{\"content-type\":\"application/json\"}:undefined}).then(async r=>{const text=await r.text(); console.log(JSON.stringify({ok:r.ok,status:r.status,body:text?JSON.parse(text):null})); process.exit(r.ok?0:1);}).catch(e=>{console.error(e); process.exit(1)})'",
|
||||
].join("\n");
|
||||
const command = ["docker", "exec", "unidesk-backend-core", "sh", "-lc", script];
|
||||
const command = ["docker", "exec", "unidesk-backend-core", "bash", "-lc", script];
|
||||
const result = runCommand(command, repoRoot);
|
||||
if (result.exitCode !== 0) return { ok: false, exitCode: result.exitCode, stdout: result.stdout.slice(-1200), stderr: result.stderr.slice(-1200) };
|
||||
try {
|
||||
|
||||
@@ -157,7 +157,7 @@ function dockerCoreFetchCommand(path: string, init?: { method?: string; body?: u
|
||||
"export url method body max_bytes",
|
||||
"bun -e 'const url=process.env.url; const method=process.env.method; const body=process.env.body; const maxBytes=Number(process.env.max_bytes||\"5000000\"); fetch(url,{method,body:body?body:undefined,headers:body?{\"content-type\":\"application/json\"}:undefined}).then(async r=>{const text=await r.text(); const out={ok:r.ok,status:r.status,body:text?JSON.parse(text):null}; const json=JSON.stringify(out); if (Buffer.byteLength(json) > maxBytes) { console.error(\"response too large\"); process.exit(1); } console.log(json); process.exit(r.ok?0:1);}).catch(e=>{console.error(e); process.exit(1)})'",
|
||||
].join("\n");
|
||||
return ["docker", "exec", "unidesk-backend-core", "sh", "-lc", script];
|
||||
return ["docker", "exec", "unidesk-backend-core", "bash", "-lc", script];
|
||||
}
|
||||
|
||||
interface RelatedContainer {
|
||||
|
||||
Reference in New Issue
Block a user