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

+3
View File
@@ -84,6 +84,9 @@ fn wasmImportHasExe(p0 : Int, p1 : Int) -> Int = "chandra:host/sys@0.1.0" "has-e
///|
fn wasmImportSpawn(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int = "chandra:host/sys@0.1.0" "spawn"
///|
fn wasmImportSpawnWatch(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int = "chandra:host/sys@0.1.0" "spawn-watch"
///|
fn wasmImportSpawnSocket(p0 : Int, p1 : Int) -> Int = "chandra:host/sys@0.1.0" "spawn-socket"
+10 -5
View File
@@ -140,6 +140,16 @@ fn wasmImportSpawn(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
abort("wasm-only host import")
}
///|
fn wasmImportSpawnWatch(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
abort("wasm-only host import")
}
///|
fn wasmImportSpawnSocket(p0 : Int, p1 : Int) -> Int {
abort("wasm-only host import")
}
///|
fn wasmImportTakeSigusr1() -> Int {
abort("wasm-only host import")
@@ -184,8 +194,3 @@ fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
fn mbt_ffi_int_array2ptr(array : FixedArray[Int]) -> Int {
abort("wasm-only")
}
///|
fn wasmImportSpawnSocket(p0 : Int, p1 : Int) -> Int {
abort("wasm-only host import")
}
@@ -44,6 +44,8 @@ pub fn spawn(String, String) -> Bool
pub fn spawn_socket(String) -> Int
pub fn spawn_watch(String, String) -> Int
pub fn take_fd(Int32) -> Int32
pub fn take_sigusr1() -> Bool
+14
View File
@@ -325,6 +325,20 @@ pub fn spawn(cmd : String, display : String) -> Bool {
mbt_ffi_free(ptr0)
return ret
}
///|
/// Launch `cmd` like `spawn`, watched: a socket that reports how it exited (see sys.wit).
pub fn spawn_watch(cmd : String, display : String) -> Int {
let ptr = mbt_ffi_str2ptr(cmd)
let ptr0 = mbt_ffi_str2ptr(display)
let result : Int = wasmImportSpawnWatch(ptr, cmd.length(), ptr0, display.length());
let ret = result
mbt_ffi_free(ptr)
mbt_ffi_free(ptr0)
return ret
}
///|
/// True once after the host process got SIGUSR1 (a request to reload the panel modules from