process: fix Windows runExec garbled CJK output [AI-assisted]#50885
process: fix Windows runExec garbled CJK output [AI-assisted]#50885zhangyongjie1997 wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes Windows CJK (mojibake) output when running Key findings:
Confidence Score: 2/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a66fca1b37
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79c1d8d9f2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
.cmd/.batexecution throughcmd.exewrapper could produce garbled CJK output because the active code page is often not UTF-8.runExecnow prependschcp 65001>nul &&on Windows cmd-wrapper paths when output decoding is UTF-8.runCommandWithTimeoutgets the same UTF-8 code-page prefix for cmd-wrapper consistency.useCmdWrappergate (avoids spurious throws on non-wrapper paths).utf8andutf-8trigger the UTF-8 code-page path.src/process/exec.windows.test.ts.Change Type
Linked Issue/PR
User-visible / Behavior Changes
.cmd/.batwrapper execution is no longer mojibake in UTF-8 decode scenarios.runExec(..., { encoding: "utf8" })andrunExec(..., { encoding: "utf-8" })now behave consistently for wrapper code-page setup.Security Impact
Repro + Verification
Environment
runExec,runCommandWithTimeout)Steps
.cmdcommand through Windows cmd-wrapper path with CJK output.utf8andutf-8).Result
pnpm test -- src/process/exec.windows.test.tsRisks and Mitigations
Closes #50519