Skip to content

Commit df21ffc

Browse files
authored
fix(core): command mpsc usage, closes #1935 (#1936)
1 parent 4bdc406 commit df21ffc

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fixes child processes messages not arriving until the subprocess is terminated.

core/tauri/src/endpoints/shell.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ impl Cmd {
102102
let pid = child.pid();
103103
command_childs().lock().unwrap().insert(pid, child);
104104

105-
crate::async_runtime::spawn(async move {
106-
while let Some(event) = rx.recv().await {
105+
// TODO: for some reason using `crate::async_runtime::spawn` and `rx.recv().await` doesn't work here, see issue #1935
106+
std::thread::spawn(move || {
107+
while let Some(event) = rx.blocking_recv() {
107108
if matches!(event, crate::api::process::CommandEvent::Terminated(_)) {
108109
command_childs().lock().unwrap().remove(&pid);
109110
}

0 commit comments

Comments
 (0)