Commit 8c7a99a
committed
fix(shims): resolve Windows batch file syntax error in generated shims
Fixes #555
The Windows .bat shim template contained problematic syntax that broke
CMD batch file parsing:
- goto/label (:found_file) inside parenthesized if (...) block
- Direct %* expansion inside nested for (...) do (...) block
These caused 'was unexpected at this time' errors when running any
Go command through the shims on Windows.
Solution:
- Move file argument detection to a safe subroutine (:detect_file_arg)
- Call subroutine using 'call' instead of inline goto/label
- Add explicit exit code propagation with exit /b %ERRORLEVEL%
This matches the safer approach suggested in the issue report and
ensures shims work correctly in both cmd.exe and PowerShell.1 parent 48da144 commit 8c7a99a
1 file changed
Lines changed: 16 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
243 | 245 | | |
244 | | - | |
245 | | - | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
| 251 | + | |
| 252 | + | |
261 | 253 | | |
262 | 254 | | |
263 | 255 | | |
| |||
268 | 260 | | |
269 | 261 | | |
270 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
271 | 274 | | |
272 | 275 | | |
273 | 276 | | |
| |||
0 commit comments