Skip to content

Commit 970f685

Browse files
committed
feat(desktop): non-fatal sidecar spawn; verified real window renders under xvfb
If the sidecar can't start (missing binary, port already in use), log and keep the window on the splash instead of aborting the whole app — better failure UX, and it lets `cargo run` dev attach to an externally-run `openkb-api`. Verified end-to-end: built the web UI, ran openkb-api on :8765, launched the Tauri binary under xvfb (WebKitGTK). The shell polled the server, navigated off the splash, and rendered the real Workbench UI — confirming the full shell → poll → navigate → render flow works. Claude-Session: https://claude.ai/code/session_01KZyUSGAzVL9yxpsWWPv6Y2
1 parent 307469e commit 970f685

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

desktop/src-tauri/src/main.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,16 @@ fn main() {
6868
tauri::Builder::default()
6969
.manage(Sidecar(Mutex::new(None)))
7070
.setup(|app| {
71-
let child = spawn_sidecar(app)?;
72-
app.state::<Sidecar>().0.lock().unwrap().replace(child);
71+
// Non-fatal: if the sidecar can't start (missing binary, port in
72+
// use), keep the window up on the splash rather than crashing the
73+
// app. In `cargo run` dev the bundled sidecar isn't present, so
74+
// this lets the shell attach to an externally-run `openkb-api`.
75+
match spawn_sidecar(app) {
76+
Ok(child) => {
77+
app.state::<Sidecar>().0.lock().unwrap().replace(child);
78+
}
79+
Err(e) => eprintln!("openkb: could not spawn sidecar: {e}"),
80+
}
7381

7482
let url = format!("http://{HOST}:{PORT}/");
7583
let handle = app.handle().clone();

0 commit comments

Comments
 (0)