Console.Unix: fix OpenStandardInput Stream sometimes throwing for Reads. (#62153)
authorTom Deseyn <tom.deseyn@gmail.com>
Wed, 1 Dec 2021 08:35:36 +0000 (09:35 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Dec 2021 08:35:36 +0000 (09:35 +0100)
commite51c22af85c4663e272eed81690058598350beba
tree049d4fa06267d9b26beeab84415d82940854ce1f
parent4aa8167f764f8abe015754ed9288c318aec6169d
Console.Unix: fix OpenStandardInput Stream sometimes throwing for Reads. (#62153)

* Console.Unix: fix OpenStandardInput Stream sometimes throwing for Reads.

When connected to a terminal reads happen line-by-line.

StdInReader caches the line in a StringBuilder.

Instead of returning when the destination buffer is full, an attempt
was made to decode the next chunk from the StringBuilder (if there is
one). This causes the encoder to throw for encoding into an empty buffer.
src/libraries/System.Console/src/System/IO/StdInReader.cs
src/libraries/System.Console/tests/ManualTests/ManualTests.cs