From 3c7796968003c2194217b8b9892c06cd061b1b9d Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Mon, 18 May 2026 17:25:30 -0700 Subject: [PATCH] =?UTF-8?q?fix(m1):=20inotify=20=E2=80=94=20use=20read=5Ft?= =?UTF-8?q?o=5Fend=20for=20UTF-8=20resilience,=20await=20spawn=5Fblocking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - read_to_end + from_utf8_lossy replaces read_to_string so Wine/game logs with Latin-1 bytes are handled via U+FFFD replacement instead of silently dropping all events from that file - bytes_read from I/O call used for new_pos (not content.len()) for correct byte position accounting - spawn_blocking handle is now awaited so panics inside the blocking task surface to the caller instead of being silently swallowed --- src-tauri/src/watcher/inotify.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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())