Fix the line buffer that was flooded with extra \0
This commit is contained in:
parent
53e5c929ca
commit
b33f65fd44
1 changed files with 1 additions and 1 deletions
|
@ -28,7 +28,7 @@ fn do_read_stdin(tx: &Sender<Vec<u8>>) -> Result<(), String> {
|
||||||
if len == 0 {
|
if len == 0 {
|
||||||
return Err(String::from("unable to read on stdin"));
|
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 {
|
loop {
|
||||||
match line_buffer.iter().position(|i| *i == b'\n') {
|
match line_buffer.iter().position(|i| *i == b'\n') {
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
|
|
Reference in a new issue