From aff47992b3d180b60f6caa8e3b3babbe71ed9411 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Thu, 23 May 2024 02:16:39 +0300 Subject: [PATCH] fix(shell): make `execute` command async (#1362) closes #1361 --- .changes/shell-execute.md | 5 +++++ plugins/shell/src/commands.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/shell-execute.md diff --git a/.changes/shell-execute.md b/.changes/shell-execute.md new file mode 100644 index 00000000..39a862f6 --- /dev/null +++ b/.changes/shell-execute.md @@ -0,0 +1,5 @@ +--- +"shell": "patch" +--- + +Run `Command.execute()` JS api, asynchronously in the Rust side to avoid blocking main thread and causing the webview to freeze. diff --git a/plugins/shell/src/commands.rs b/plugins/shell/src/commands.rs index dce61ec5..b5f1ea5a 100644 --- a/plugins/shell/src/commands.rs +++ b/plugins/shell/src/commands.rs @@ -186,7 +186,7 @@ pub struct ChildProcessReturn { #[allow(clippy::too_many_arguments)] #[tauri::command] -pub fn execute( +pub async fn execute( window: Window, program: String, args: ExecuteArgs,