Skip to content

Commit

Permalink
re-threadify program launching
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Jul 12, 2022
1 parent b358592 commit 33c67ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src-tauri/src/system_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use crate::file_helpers;

#[tauri::command]
pub fn run_program(path: String) {
// Open the program from the specified path.
open::that(&path).unwrap();
// Open in new thread to prevent blocking.
thread::spawn(move || {
open::that(&path).unwrap();
});
}

#[tauri::command]
Expand Down

1 comment on commit 33c67ee

@Seeker14491
Copy link
Contributor

@Seeker14491 Seeker14491 commented on 33c67ee Jul 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had removed the thread spawn because the open crate docs said that open::that() never blocks. Was that not the case?

edit: I realize I didn't update the open crate to v3 when I removed the thread spawn, but v3 is needed to guarantee there is no blocking.

Please sign in to comment.