Return an error if end of file is reached on stdin

This commit is contained in:
Rodolphe Breard 2019-09-17 17:50:51 +02:00
parent dfa61a9eaa
commit 6b532242ef

View file

@ -52,7 +52,7 @@ impl FilterInput for StdIn {
}, },
}; };
if len == 0 { if len == 0 {
continue; return Err(Error::new("Unable to read on stdin."));
} }
// Put the buffer's content in self.input // Put the buffer's content in self.input
self.input += match self.buffer.iter().position(|&x| x == 0) { self.input += match self.buffer.iter().position(|&x| x == 0) {