diff --git a/src-tauri/src/watcher/inotify.rs b/src-tauri/src/watcher/inotify.rs index 3013ad2..577b6be 100644 --- a/src-tauri/src/watcher/inotify.rs +++ b/src-tauri/src/watcher/inotify.rs @@ -57,7 +57,9 @@ pub async fn watch(log_paths: HashMap, tx: mpsc::Sender String { @@ -77,9 +79,10 @@ pub fn read_new_lines(path: &str, from_byte: u64) -> (Vec, u64) { if file.seek(std::io::SeekFrom::Start(from_byte)).is_err() { return (vec![], from_byte); } - let mut content = String::new(); - let _ = file.read_to_string(&mut content); - let new_pos = from_byte + content.len() as u64; + let mut raw = Vec::new(); + let bytes_read = file.read_to_end(&mut raw).unwrap_or(0); + let content = String::from_utf8_lossy(&raw).into_owned(); + let new_pos = from_byte + bytes_read as u64; let lines: Vec = content .lines() .filter(|l| !l.is_empty())