Skip to content

Commit

Permalink
fix: incorrect bytes when communicating with stanza on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
BrewingWeasel committed Aug 19, 2024
1 parent 77b2f6f commit 3d4dc32
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src-tauri/src/language_parsing.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
collections::HashMap,
io::{BufRead, BufReader, Read, Write},
io::{BufRead, BufReader, Write},
process,
sync::Arc,
};
Expand Down Expand Up @@ -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 }))?;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3d4dc32

Please sign in to comment.