Skip to content

Commit

Permalink
👷 pages: refactor detached spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Jan 4, 2025
1 parent e3468c1 commit 8f5531d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,15 +1078,15 @@ fn on_appbtn_clicked(button: &gtk::Button) {
return;
}

// Get executable path.
let bash_cmd = format!("{} &disown", exec_path.unwrap().to_str().unwrap());

// Create context channel.
let (tx, rx) = glib::MainContext::channel(glib::Priority::default());

// Spawn child process in separate thread.
std::thread::spawn(move || {
let exit_status = Exec::shell(bash_cmd).join().unwrap();
// Get executable path.
let exec_path = exec_path.unwrap().to_str().unwrap().to_owned();
let exit_status = Exec::cmd(exec_path).detached().join().expect("Failed to spawn process");

tx.send(format!("Exit status successfully? = {:?}", exit_status.success()))
.expect("Couldn't send data to channel");
});
Expand Down

0 comments on commit 8f5531d

Please sign in to comment.