From cc3d8e77313672f25520e278bbe8fae1b275a735 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 1 Feb 2024 19:06:05 +0800 Subject: [PATCH] fix(core): Command::output suspend while wait for response (#8539) * fix: Command::output suspend while wait for response * add change file --------- Co-authored-by: Lucas Nogueira Co-authored-by: Lucas Fernandes Nogueira --- .changes/fix-command-spawn-deadlock.md | 5 +++++ core/tauri/src/api/process/command.rs | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changes/fix-command-spawn-deadlock.md diff --git a/.changes/fix-command-spawn-deadlock.md b/.changes/fix-command-spawn-deadlock.md new file mode 100644 index 000000000..2d352fe11 --- /dev/null +++ b/.changes/fix-command-spawn-deadlock.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:bug +--- + +Fixes a deadlock when reading a stdout or stderr line returns an error. diff --git a/core/tauri/src/api/process/command.rs b/core/tauri/src/api/process/command.rs index 6b3fd73db..6b630bad0 100644 --- a/core/tauri/src/api/process/command.rs +++ b/core/tauri/src/api/process/command.rs @@ -420,6 +420,7 @@ fn spawn_pipe_reader CommandEvent + Send + Copy + 'static>( Err(e) => { let tx_ = tx.clone(); let _ = block_on_task(async move { tx_.send(CommandEvent::Error(e.to_string())).await }); + break; } } }