Skip to content

Commit 8f5531d

Browse files
committed
👷 pages: refactor detached spawn
1 parent e3468c1 commit 8f5531d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/pages.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,15 +1078,15 @@ fn on_appbtn_clicked(button: &gtk::Button) {
10781078
return;
10791079
}
10801080

1081-
// Get executable path.
1082-
let bash_cmd = format!("{} &disown", exec_path.unwrap().to_str().unwrap());
1083-
10841081
// Create context channel.
10851082
let (tx, rx) = glib::MainContext::channel(glib::Priority::default());
10861083

10871084
// Spawn child process in separate thread.
10881085
std::thread::spawn(move || {
1089-
let exit_status = Exec::shell(bash_cmd).join().unwrap();
1086+
// Get executable path.
1087+
let exec_path = exec_path.unwrap().to_str().unwrap().to_owned();
1088+
let exit_status = Exec::cmd(exec_path).detached().join().expect("Failed to spawn process");
1089+
10901090
tx.send(format!("Exit status successfully? = {:?}", exit_status.success()))
10911091
.expect("Couldn't send data to channel");
10921092
});

0 commit comments

Comments
 (0)