From 65a9e142b536ff86d316c2408789036af70b3335 Mon Sep 17 00:00:00 2001 From: Andrei Ivanou Date: Sun, 17 May 2026 16:41:25 +0200 Subject: [PATCH] fix(process): prevent zombie shell processes --- cosmic-panel-button/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cosmic-panel-button/src/lib.rs b/cosmic-panel-button/src/lib.rs index 718744b0..45ee1ca2 100644 --- a/cosmic-panel-button/src/lib.rs +++ b/cosmic-panel-button/src/lib.rs @@ -123,11 +123,15 @@ impl cosmic::Application for Button { fn update(&mut self, message: Msg) -> app::Task { match message { Msg::Press => { - let _ = Command::new("sh") + if let Ok(mut child) = Command::new("sh") .arg("-c") - .arg(&self.desktop.exec) + .arg(format!("exec {}", self.desktop.exec)) .spawn() - .unwrap(); + { + std::thread::spawn(move || { + let _ = child.wait(); + }); + } } Msg::ConfigUpdated(conf) => { self.config = conf