Fix the line buffer that was flooded with extra \0

This commit is contained in:
Rodolphe Bréard 2020-12-20 14:35:35 +01:00
parent 53e5c929ca
commit b33f65fd44

View file

@ -28,7 +28,7 @@ fn do_read_stdin(tx: &Sender<Vec<u8>>) -> Result<(), String> {
if len == 0 {
return Err(String::from("unable to read on stdin"));
}
line_buffer.extend_from_slice(&read_buffer);
line_buffer.extend_from_slice(&read_buffer[..len]);
loop {
match line_buffer.iter().position(|i| *i == b'\n') {
Some(id) => {