fix(process): prevent zombie shell processes
This commit is contained in:
parent
666f0110d6
commit
65a9e142b5
1 changed files with 7 additions and 3 deletions
|
|
@ -123,11 +123,15 @@ impl cosmic::Application for Button {
|
||||||
fn update(&mut self, message: Msg) -> app::Task<Msg> {
|
fn update(&mut self, message: Msg) -> app::Task<Msg> {
|
||||||
match message {
|
match message {
|
||||||
Msg::Press => {
|
Msg::Press => {
|
||||||
let _ = Command::new("sh")
|
if let Ok(mut child) = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(&self.desktop.exec)
|
.arg(format!("exec {}", self.desktop.exec))
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
{
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
let _ = child.wait();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Msg::ConfigUpdated(conf) => {
|
Msg::ConfigUpdated(conf) => {
|
||||||
self.config = conf
|
self.config = conf
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue