From 070d07b27caf021ab2ed4339fc5e128720f62321 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Thu, 4 Aug 2022 18:50:47 +0200 Subject: [PATCH] [fix] UnexpectedEof is ok and should not show an error --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 97c424c..7a7c994 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,7 +55,13 @@ fn run() -> LogtimesResult { loop { // read 1 char - input.read_exact(&mut buf)?; + if let Err(e) = input.read_exact(&mut buf) { + if e.kind() == ErrorKind::UnexpectedEof { + return Ok(()); + } else { + return Err(e); + } + } // push that char to the "current line" buffer linebuf.push(buf[0]);