backend: ensure logs are pushed to the frontend when the process terminates (#584)
Some checks failed
📝 Linter / Frontend (push) Has been cancelled
📝 Linter / Backend Formatting (push) Has been cancelled
📝 Linter / Backend Linter (push) Has been cancelled
🧪 Tests / Frontend (push) Has been cancelled
🔨 Build / App (macos-12) (push) Has been cancelled
🔨 Build / App (ubuntu-20.04) (push) Has been cancelled
🔨 Build / App (windows-latest) (push) Has been cancelled

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)
This commit is contained in:
Tyler Wilding 2024-10-05 02:12:15 -04:00 committed by GitHub
parent 6ea179ae98
commit 88f93aab4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}