From 3d4dc320d57380d1de0bb41c56c8ce0d5111e65f Mon Sep 17 00:00:00 2001 From: Finn Brewer Date: Mon, 19 Aug 2024 11:19:43 -0700 Subject: [PATCH] fix: incorrect bytes when communicating with stanza on windows --- src-tauri/src/language_parsing.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/language_parsing.rs b/src-tauri/src/language_parsing.rs index c3861df..0796afa 100644 --- a/src-tauri/src/language_parsing.rs +++ b/src-tauri/src/language_parsing.rs @@ -1,6 +1,6 @@ use std::{ collections::HashMap, - io::{BufRead, BufReader, Read, Write}, + io::{BufRead, BufReader, Write}, process, sync::Arc, }; @@ -443,10 +443,10 @@ pub async fn start_stanza(state: State<'_, KalbaState>, window: Window) -> Resul }), )?; - let mut buf = [0; 5]; - stdout.read_exact(&mut buf)?; - if buf != "done\n".as_bytes() { - panic!("Starting stanza failed {}", String::from_utf8_lossy(&buf)) + let mut buf = String::new(); + stdout.read_line(&mut buf)?; + if buf.trim_end() != "done" { + panic!("Starting stanza failed {buf}"); } log::info!("Stanza model loaded"); window.emit("stanza_loading", Some(ToasterPayload { message: None }))?; @@ -484,7 +484,7 @@ fn stanza_parser( .stdout .read_line(&mut specific_contents) .is_err() - || specific_contents == "done\n" + || specific_contents.trim_end() == "done" { break; }