mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:30:42 +00:00
fix: isolate docs i18n codex home
This commit is contained in:
@@ -179,6 +179,12 @@ func runCodexExecPrompt(ctx context.Context, req codexPromptRequest) (string, er
|
||||
_ = outputFile.Close()
|
||||
defer os.Remove(outputPath)
|
||||
|
||||
codexHome, err := os.MkdirTemp("", "openclaw-docs-i18n-codex-home-*")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer os.RemoveAll(codexHome)
|
||||
|
||||
args := []string{
|
||||
"exec",
|
||||
"--model", req.Model,
|
||||
@@ -191,6 +197,7 @@ func runCodexExecPrompt(ctx context.Context, req codexPromptRequest) (string, er
|
||||
}
|
||||
command := exec.CommandContext(ctx, docsCodexExecutable(), args...)
|
||||
command.Stdin = strings.NewReader(buildCodexTranslationPrompt(req.SystemPrompt, req.Message))
|
||||
command.Env = append(os.Environ(), "CODEX_HOME="+codexHome)
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
command.Stdout = &stdout
|
||||
|
||||
@@ -149,6 +149,10 @@ while [ "$#" -gt 0 ]; do
|
||||
shift || true
|
||||
done
|
||||
cat >/dev/null
|
||||
if [ -z "${CODEX_HOME:-}" ]; then
|
||||
echo "missing CODEX_HOME" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'translated from codex\n' > "$out"
|
||||
`), 0o755); err != nil {
|
||||
t.Fatalf("write fake codex: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user