From 88f93aab4c73b17478de8fbe23285b0aa19ee6a6 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 5 Oct 2024 02:12:15 -0400 Subject: [PATCH] backend: ensure logs are pushed to the frontend when the process terminates (#584) This was leading to awkward situations where there are no logs in the frontend if the binaries immediately fail. Fixed now: ![image](https://github.com/user-attachments/assets/441e6b7d-2f59-487c-b47d-a49d46eb8c12) --- src-tauri/src/util/process.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src-tauri/src/util/process.rs b/src-tauri/src/util/process.rs index af3f49d..1215f9d 100644 --- a/src-tauri/src/util/process.rs +++ b/src-tauri/src/util/process.rs @@ -85,6 +85,9 @@ pub async fn watch_process( }, // Wait for the child process to finish status = child.wait() => { + let mut buf = buffer_clone.lock().await; + let _ = app_handle.emit_all("log_update", LogPayload { logs: buf.clone() }); + buf.clear(); process_status = Some(status?); break; }