…quoting
The previous fix pre-quoted the executable path, but the actual breakage was
in argument paths (-C repo_root, -o output_file) containing spaces. Pre-embedding
quotes in a subprocess list causes double-quoting because Popen's list2cmdline()
adds its own quotes.
The real issue: cmd /c concatenates everything after /c and re-parses it with its
own tokeniser. The fix introduces _wrap_cmd_c() which uses subprocess.list2cmdline()
to build the inner command as a single properly-quoted string, then passes that as
one token after /c: ["cmd", "/c", "codex exec -C \"path with spaces\" ..."].
- Revert incorrect executable pre-quoting in _resolve_executable
- Add _wrap_cmd_c() to properly collapse cmd /c commands
- Apply _wrap_cmd_c in codex_batch_command after building the full arg list
- Keep correct encoding="utf-8", errors="replace" fix in io.py
- Add tests for _wrap_cmd_c and Windows codex_batch_command path quoting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
cmd /ccommands on Windows, preventing subprocess spawn failuresencoding="utf-8", errors="replace"toread_text()calls in log recovery (io.py), preventingUnicodeDecodeErroron Windows where the default encoding is cp1252Fixes #442
Test plan
🤖 Generated with Claude Code