logoalt Hacker News

teddyhyesterday at 7:43 PM1 replyview on HN

> Surprisingly, Rust, as of now, uses line buffering for both TTYs and non-TTYs.

> The FIXME comment shows the Rust team acknowledges that ideally they should check if something is executed in TTYs or not and use LineWriter or BufWriter accordingly, but I guess this was not on their priority list.

This does not inspire confidence.


Replies

dwatttttyesterday at 10:53 PM

That's not forced behaviour. If you want to do something more interesting, you'd use the raw/unsynchronised handles:

  /// The returned handle has no external synchronization or buffering layered on top.
  const fn stdout_raw() -> StdoutRaw;