Commit 3bf5df9
committed
fix: codex login on Windows hit nested quoting hell
Clicking 'codex 认证' on Chinese Windows produced '文件名、目录名或卷
标语法不正确' before codex ever started. The launcher was spawning:
cmd.exe /c start cmd.exe /k <command-with-quoted-path-and-args>
which forced the argv through four parsers in a row - Node
child_process argv quoting, outer cmd.exe /c, start, and inner
cmd.exe /k - each with different quote escape rules. Node emits
CRT-style '"' for embedded quotes; cmd.exe does not understand
that escape and chopped 'cd /d "C:\...\"' into a literal
backslash plus a broken path. 'cd /d' then rejected the path.
Reduce parsing to a single layer by writing the command to a
temp .bat file (ASCII + CRLF, at a fixed path in $TEMP so
successive logins do not accumulate files) and launching it with
'cmd /c start "" <batPath>'. The quotes inside the bat are now
interpreted once, by the bat's own cmd.exe, exactly as typed.
Also add a unit test that asserts the generated bat content is
ASCII-only with CRLF line endings and contains the right cd /d
and codex invocation - future regressions fail at npm test time
instead of on a real Windows box.1 parent 43869e2 commit 3bf5df9
2 files changed
Lines changed: 69 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
3 | 6 | | |
4 | 7 | | |
| |||
134 | 137 | | |
135 | 138 | | |
136 | 139 | | |
137 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
138 | 154 | | |
139 | 155 | | |
140 | | - | |
| 156 | + | |
141 | 157 | | |
142 | | - | |
| 158 | + | |
| 159 | + | |
143 | 160 | | |
144 | 161 | | |
145 | 162 | | |
| |||
169 | 186 | | |
170 | 187 | | |
171 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
172 | 211 | | |
173 | 212 | | |
174 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
46 | 72 | | |
47 | 73 | | |
48 | 74 | | |
| |||
0 commit comments