Commit ac05562
committed
fix(ui): do not call setvbuf on Windows — size 0 aborts the process
The UCRT documents setvbuf's size as `2 <= size <= INT_MAX`. Zero goes through
the invalid-parameter handler, whose default action terminates the process:
0xC0000409, which git-bash reports as a bare exit 127. The freshly built
mcpp.exe died on `--version` with no output at all, right after a green build —
the same mask mcpp#230 wore.
Passing a real size instead would buy nothing: MSVCRT has no line buffering, it
accepts _IOLBF and treats it as _IOFBF. Windows already gets the guarantee from
ui::flush(), which every stdout-writing function in this module calls and which
`mcpp test`'s result lines now route through. So the platform that cannot do
this cheaply is also the one that does not need it — and its 4096-byte block
was the smallest of the three to begin with.
Line-flushing on Linux re-verified after the change: 421 individual writes for
a 30-member workspace test, versus 3 block writes before this series.1 parent 2f1bc1c commit ac05562
1 file changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
248 | 265 | | |
249 | 266 | | |
250 | 267 | | |
| |||
0 commit comments