Launches that fail say why: command, exit status and what it printed
CI / test (push) Canceled after 17m11s

V: "kwi not starting from app menu or dock". Kwi is a Flatpak, and bwrap died
before it opened a window ("Can't find source path /run/user/1000/doc/by-app/
org.kde.kwi"); Chandra forked apps and forgot them, so the failure only reached
the session log and the click did nothing visible.

Every app the Applications menu, the dock, Super+1..9 and session restore start
now runs under a small monitor (sys spawn-watch, compositor/sys/sys_stub.c): it
copies the app's output to the session log as before, keeps its last 2 KiB,
and reports how sh -c CMD exited on a socket the main loop wakes on. The shell
(compositor/shell/launch.mbt) shows a red error notice for 15 s, and logs it,
when the app exits non-zero or by a signal within 30 s, or exits 0 without ever
opening a window here (after a 2 s grace for single-instance hand-offs): the
first line says what happened, then the command and the last lines it printed,
repeats folded ("(3 times)"). Status 127/126 say "command not found" / "not
executable". Launched apps no longer inherit the compositor's fds.

chandra-ctl launch ID starts a desktop app exactly as the dock does.

Tests: compositor/host/launch_test.mbt (bwrap-style failure incl. drawn notice,
127, SIGSEGV, exit 0 without a window, an app that keeps running), unit tests
in launch.mbt. Checked end to end with build/wasmhost + compositor.wasm
headless and a Flatpak-style kwi desktop file: chandra-ctl launch org.kde.kwi
shows the notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiGJWeuHiTgtoyB4kb
This commit is contained in:
Claude committed 2026-11-26 05:48:39 +00:00
1 parent 77fcc4db1c
commit 50149e6b99
18 files changed
+686 -30

No files matched your search

+40 -5
View File
@@ -215,10 +215,44 @@ fn DesktopShell::panel_fits(self : DesktopShell) -> Bool {
///| Show a short message above the panel for a few seconds.
pub fn DesktopShell::say(self : DesktopShell, msg : String) -> Unit {
self.notice = msg
self.notice_lines = []
self.notice_secs = 4
self.notice_frames = 1
self.notice_start = wall_secs()
}
///| Show an error notice: the first line is what went wrong, the rest the details. It stays 15
/// seconds, and the same lines go to the session log.
pub fn DesktopShell::say_error(self : DesktopShell, lines : Array[String]) -> Unit {
self.notice = lines.get(0).unwrap_or("")
self.notice_lines = lines
self.notice_secs = 15
self.notice_frames = 1
self.notice_start = wall_secs()
}
///| The notice's lines as drawn: long ones wrapped at `max` characters, at most 10.
fn notice_rows(lines : Array[String], max : Int) -> Array[String] {
let out : Array[String] = []
for l in lines {
let chars = l.to_array()
let mut i = 0
while i < chars.length() || i == 0 {
let end = if i + max < chars.length() { i + max } else { chars.length() }
out.push(String::from_array(chars[i:end].to_array()))
i = end
if end == chars.length() {
break
}
}
}
if out.length() > 10 {
out[out.length() - 10:].to_array()
} else {
out
}
}
///| Seconds since local midnight (wall clock).
fn wall_secs() -> Int {
@sys.wall_time_field(3) * 3600 + @sys.wall_time_field(4) * 60 + @sys.wall_time_field(5)
@@ -829,14 +863,15 @@ pub fn DesktopShell::set_power_timeouts(self : DesktopShell, screen_off : Int, s
///| Start the catalog app `id` (a desktop file id) and remember it as the latest launch.
fn DesktopShell::launch_catalog_app(self : DesktopShell, id : String) -> Unit {
match self.command_for(id) {
Some(bin) =>
if @sys.spawn(bin, self.display) {
Some(cmd) =>
if self.start_app(id, cmd) {
self.note_recent(id)
self.apps_dirty = true
} else {
self.say("Could not start " + bin)
}
None => self.say("No executable for " + id)
None => {
self.say_error(["Could not start " + id + ": no installed .desktop file has that id"])
@sys.log("chandra: launch failed: no desktop file for " + id)
}
}
}