Skip to content

Commit 7e3ac84

Browse files
authored
fix(core): command stack overflow on Windows, closes #4548 (#4562)
1 parent 23d3d84 commit 7e3ac84

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
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+
Fix stack overflow on Windows on commands by changing the implementation of the `async_runtime::spawn` method.

core/tauri/src/async_runtime.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ impl Runtime {
103103
F::Output: Send + 'static,
104104
{
105105
match self {
106-
Self::Tokio(r) => JoinHandle::Tokio(r.spawn(task)),
106+
Self::Tokio(r) => {
107+
let _guard = r.enter();
108+
JoinHandle::Tokio(tokio::spawn(task))
109+
}
107110
}
108111
}
109112

@@ -193,7 +196,10 @@ impl RuntimeHandle {
193196
F::Output: Send + 'static,
194197
{
195198
match self {
196-
Self::Tokio(h) => JoinHandle::Tokio(h.spawn(task)),
199+
Self::Tokio(h) => {
200+
let _guard = h.enter();
201+
JoinHandle::Tokio(tokio::spawn(task))
202+
}
197203
}
198204
}
199205

0 commit comments

Comments
 (0)