Reset the "force_read" flag

This commit is contained in:
Rodolphe Breard 2019-09-17 17:11:30 +02:00
parent 45639f18c0
commit 681563934a

View file

@ -36,6 +36,8 @@ impl FilterInput for StdIn {
let mut force_read = false; let mut force_read = false;
loop { loop {
if force_read || self.input.is_empty() { if force_read || self.input.is_empty() {
// Reset the flag
force_read = false;
// Read stdin in self.buffer // Read stdin in self.buffer
self.buffer.copy_from_slice(&[0; BUFFER_SIZE]); self.buffer.copy_from_slice(&[0; BUFFER_SIZE]);
let len = self.stdin.read(&mut self.buffer)?; let len = self.stdin.read(&mut self.buffer)?;