Commit 35a0e5e
committed
fix(cli): do not assume why a line was unreadable, and bound the retries
The previous commit caught ValueError from readline() and asserted it was a
limit overrun. It only knew an exception had been raised.
That mattered beyond the message. Skipping the line is safe only for the
overrun case, where readline() has already discarded the line and resumed the
transport before raising. readline() flattens LimitOverrunError into a bare
ValueError, so the two are indistinguishable at the call site, and any other
ValueError that consumes nothing would have spun the loop forever at 100% CPU
while still not draining the pipe. That is worse than the freeze being fixed.
Now: report the actual exception with repr() and no assumed cause, and bound
consecutive failures at MAX_CONSECUTIVE_READ_ERRORS (100). Past that, re-raise
so the outer handler reports that nothing is draining the child's stdout.
The outer try/except is load-bearing, not vestigial: it is the escalation path
for that re-raise, and it still covers console.print failures and non-ValueError
transport errors. It does not swallow cancellation, since CancelledError derives
from BaseException, so the auto-reload path that cancels these tasks is
unaffected (verified).
(cherry picked from commit 13fa1f5c28f1687f1f90469c22eba9bccf1bbc82)1 parent ef6ff46 commit 35a0e5e
1 file changed
Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
255 | 260 | | |
256 | 261 | | |
257 | 262 | | |
| 263 | + | |
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
261 | 267 | | |
262 | | - | |
263 | | - | |
264 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
265 | 278 | | |
266 | | - | |
267 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
268 | 283 | | |
269 | 284 | | |
270 | 285 | | |
| 286 | + | |
| 287 | + | |
271 | 288 | | |
272 | 289 | | |
273 | 290 | | |
| |||
0 commit comments