git.lucas.co / cce-files
file manager
git clone https://git.lucas.co/cce-files.git

commit4c9a8cb6aa6ec532cd0b8ebc6f6a3280ff95b180
parent887265c948
authorLucas Galante <lsgalante12@gmail.com>
date2026-09-28 19:15
fix: restore the reaping spawn cce-ui 4e94236 removed

cce-ui 4e94236 deleted its process module as caller-less, but
spawn_command_for_path and open_file both called
cce_ui::process::spawn_detached, so the crate no longer compiled against
the pinned toolkit. Give fs.rs its own copy of the helper — spawn, then
wait on the child from a background thread so a finished opener never
lingers as a zombie — rather than restoring it in the shared crate, so
the crate keeps building standalone whatever the toolkit does next.
Same fix as cce-mail d5f8394.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

 src/services/fs.rs | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/services/fs.rs b/src/services/fs.rs
index 90c17bf..c8d61a6 100644
--- a/src/services/fs.rs
+++ b/src/services/fs.rs
@@ -675,7 +675,18 @@ pub fn spawn_command_for_path(cmd: &str, path: &Path) -> bool {
         command.arg(arg);
     }
     command.arg(path);
-    cce_ui::process::spawn_detached(command).is_ok()
+    spawn_detached(command).is_ok()
+}
+
+/// Spawn `cmd` and reap it on a background thread, so the child never lingers
+/// as a zombie once it exits. This was `cce_ui::process::spawn_detached` until
+/// the toolkit dropped that module (cce-ui 4e94236) as caller-less — it had two callers here.
+fn spawn_detached(mut cmd: std::process::Command) -> std::io::Result<()> {
+    let mut child = cmd.spawn()?;
+    std::thread::spawn(move || {
+        let _ = child.wait();
+    });
+    Ok(())
 }
 
 pub fn open_file(path: &Path) {
@@ -687,7 +698,7 @@ pub fn open_file(path: &Path) {
     if !opened {
         let mut command = std::process::Command::new("xdg-open");
         command.arg(path);
-        let _ = cce_ui::process::spawn_detached(command);
+        let _ = spawn_detached(command);
     }
 }