mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 16:56:33 +00:00
fix(terminal+journal): forward via WorkerMsg (GTK thread) + journal fallback
Terminal: idle_add_local_once from non-GTK thread silently fails. Forward ShowTerminalCode/DismissTerminalCode through WorkerMsg channel which IS polled on the GTK main thread via timeout_add_local. Journal: try --user-unit first, fall back to unfiltered journal if permission denied (bfkiosk user may not be in systemd-journal group on non-reflashed images). Send error line back to admin UI on spawn failure instead of silent drop.
This commit is contained in:
parent
7425fa9c63
commit
6d577b5411
2 changed files with 15 additions and 11 deletions
|
|
@ -121,15 +121,22 @@ impl JournalStream {
|
|||
let kill_clone = kill.clone();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
// Try unit-scoped first, fall back to all journal if permission denied.
|
||||
let mut child = match Command::new("journalctl")
|
||||
.args(["-u", "betterframe-kiosk", "-f", "--no-pager", "-o", "short-iso", "-n", "50"])
|
||||
.args(["--user-unit", "betterframe-kiosk", "-f", "--no-pager", "-o", "short-iso", "-n", "50"])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::null())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
.or_else(|_| Command::new("journalctl")
|
||||
.args(["-f", "--no-pager", "-o", "short-iso", "-n", "50"])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn())
|
||||
{
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
warn!("remote-debug: journalctl spawn failed: {e}");
|
||||
on_line(&format!("[ERROR] journalctl spawn failed: {e}"));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -266,17 +266,10 @@ fn activate(app: &Application) {
|
|||
maybe_apply_firmware_update(&server_for_reload, &key_for_reload);
|
||||
}
|
||||
ServerMsg::ShowTerminalCode(code) => {
|
||||
// Overlay on all windows: big centered code text.
|
||||
// NOT logged — security requirement.
|
||||
let code_clone = code.clone();
|
||||
gtk::glib::idle_add_local_once(move || {
|
||||
show_terminal_code_overlay(&code_clone);
|
||||
});
|
||||
let _ = tx_for_reload.send(WorkerMsg::ShowTerminalCode(code));
|
||||
}
|
||||
ServerMsg::DismissTerminalCode => {
|
||||
gtk::glib::idle_add_local_once(|| {
|
||||
dismiss_terminal_code_overlay();
|
||||
});
|
||||
let _ = tx_for_reload.send(WorkerMsg::DismissTerminalCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -334,6 +327,8 @@ fn activate(app: &Application) {
|
|||
}
|
||||
WorkerMsg::Standby(display_id) => standby_display(display_id),
|
||||
WorkerMsg::Wake(display_id) => wake_display(display_id),
|
||||
WorkerMsg::ShowTerminalCode(code) => show_terminal_code_overlay(&code),
|
||||
WorkerMsg::DismissTerminalCode => dismiss_terminal_code_overlay(),
|
||||
}
|
||||
}
|
||||
gtk::glib::ControlFlow::Continue
|
||||
|
|
@ -349,6 +344,8 @@ pub enum WorkerMsg {
|
|||
},
|
||||
Standby(Option<u32>),
|
||||
Wake(Option<u32>),
|
||||
ShowTerminalCode(String),
|
||||
DismissTerminalCode,
|
||||
}
|
||||
|
||||
fn output_name_for_display(display_id: u32) -> Option<String> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue