Description
Hi all,
I'm getting a weird stdin blocking issue. when reading from stdin, the console appears to freeze, nothing except what i type is written to the console. however, on windows, when the app is terminated the console buffer is "flushed", and all missing output is written, this doesnt seem to happen on linux (again, through ssh).
I originally encountered this issue on windows, but i was able to replicate it on linux with an (slightly) older toolchain (through ssh)
I will test beta, nightly, and a much older toolchain soon.
I tried this code:
use std::io::Read;
fn main() -> std::io::Result<()> {
println!("type your input");
let mut buffer = String::new();
std::io::stdin().read_to_string(&mut buffer)?;
println!("got input {}", buffer);
Ok(())
}
I expected to see this happen: "type your input" logged, the message i typed, and after hitting enter, "got input {X}" being logged, and the program closing
Instead, this happened: *"type out input" is logged, my message appears as im writing, but hitting enter does not input the message, almost like it inserts a newline instead. after this, the program must be terminated with ctrl+c *
linux:
windows:
Meta
rustc --version --verbose
:
(linux)
rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0
(windows)
rustc 1.53.0 (53cb7b09b 2021-06-17)
binary: rustc
commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
commit-date: 2021-06-17
host: x86_64-pc-windows-msvc
release: 1.53.0
LLVM version: 12.0.1
Backtrace
N/A, the code does not crash
lmk if i forgot anything and i'll update it asap