sharkdp / hexyl

A command-line hex viewer
Apache License 2.0
8.92k stars 227 forks source link

Correctly handle discontinuous input i.e. stdin #197

Closed sharifhsn closed 11 months ago

sharifhsn commented 1 year ago

Fixes #196.

This PR properly handles the case when the reader is still available after returning an incomplete amount of data. When I initially rewrote the architecture of hexyl, I only handled spurious incomplete reads by adding a second check. However, stdin is a reader that can return incomplete reads multiple times.

This PR changes the second check to a loop that repeatedly reads until either the line buffer is filled or the reader is exhausted.

sharkdp commented 11 months ago

Thank you very much.